Questions tagged [struts-action]

An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request.

Action classes act as the controller in the MVC pattern. Action classes respond to a user action, execute business logic (or call upon other classes to do that), and then return a result that tells Struts what view to render.

One of the most common responsibilities of the Action class is to process user input on a form and then make the result of the processing available to the view page. When the form is submitted, Struts will call any set methods of the Action class that match the form field names.

98 questions
2
votes
3 answers

Struts 2 subaction

I have a struts2 form. In this form the user is asked to fill several fields. 2 of those fields are filled by picking an object from another action. In fact : main form => pickup button => new action with a new form to fill => return to the main…
Estragon
  • 1,462
  • 11
  • 12
1
vote
1 answer

Migrate struts action to spring action

I am looking for a good tutorial on migrating from struts to spring. I have multiple struts actions that I would like to refactor into spring components.
well actually
  • 11,810
  • 19
  • 52
  • 70
1
vote
2 answers

Struts 2 Execute action instead of welcome file

I'm working on a Struts 2 application and I want to execute an action (in fact I'm interested more on executing an interceptor) instead of simply showing a welcome file. What is the best way to achieve this? Thanks in advance!
Rui
  • 5,900
  • 10
  • 38
  • 56
1
vote
2 answers

Struts 2 Action error

I have a problem with struts 2 action error while forwarding from one action to another action .The problem lies as there is a interceptor in between and we are doing a redirect action Can I some how copy the action error from old action to current…
SRS
  • 11
  • 2
1
vote
0 answers

Why Struts 1 same Action method get execute one after another when it get called at same time from two browser?

public ActionForward doSearch(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { //Logging System.out.println("Inside doSearch for job | Date: " + new Date()); //doing search…
1
vote
2 answers

Upload multiple files with maintaining Index ( position at which file was uploaded) in Struts2

I have scenario that, I want to upload multiple files, In which User may or may not upload files, And I want to maintain Index at which position user has uploaded file and want to save file with that index as Name I referred …
Shantaram Tupe
  • 1,646
  • 3
  • 16
  • 42
1
vote
1 answer

how to call a particular method of action of Struts2 through jquery ajax

I am new to jquery and ajax. I want to call a particular method "logout" of action 'LoginAction' in Struts2. I am getting an error There is no Action mapped for namespace / and action name logoutLoginAction. My ajax code is: function signout(){ …
Raina
  • 45
  • 4
1
vote
1 answer

How to validate Dropdown in Struts2

I am writing an action class in which I want to print errors using Struts2. In my JSP page I got a drop down and I have 10 states in it. When I deploy the application the field error for Null always shows up without even clicking any button. I want…
user5192032
1
vote
3 answers

How to call a method in Struts2 Action Class method with javascript

We currently use the following javascript to submit the form when one of the field values change. var url = "project/location/myAction.action?name="+ lname ; document.forms[0].action = url; document.forms[0].submit(); which calls the following…
ponder275
  • 903
  • 2
  • 12
  • 33
1
vote
1 answer

Error in Struts2 ParametersInterceptor

com.opensymphony.xwork2.interceptor.ParametersInterceptor error SEVERE: Developer Notification (set struts.devMode to false to disable this message): Unexpected Exception caught setting 'Screen_name' on 'class org.ScreenCreation: Error…
yamany
  • 23
  • 6
1
vote
0 answers

Adding @RequiredStringValidator causing result not to be found

I have an Apache Struts web application. All of my actions are defined in my struts.xml file. I am trying to add support to my action classes to have validation annotations added to my project. To try and get this working I added the…
Richie
  • 4,989
  • 24
  • 90
  • 177
1
vote
1 answer

@Result at class level and method level

I'm following the Struts 2 Hello World Annotation Example tutorial by Mkyong: @Namespace("/User") @ResultPath(value="/") @Action(value="/welcome", results={@Result(name="success", location="pages/welcome_user.jsp")}) public class…
1
vote
1 answer

Giving an empty json result while executing struts 2 action class

Im trying to retrieve data from DB using hibernate ORM and get the out-put as json result using Struts2. Everything work up to retrieving data from DB, but for the json result I get only {}. I think I have done something wrong with my coding. But…
Madushan Perera
  • 2,568
  • 2
  • 17
  • 36
1
vote
1 answer

How to differentiate get and post call..?

public class CustomerAction extends ActionSupport implements ModelDriven { @Autowired private CustomerService customerService; // private UserService userService; int userId = getUserId(); CustomerForm…
new coder
  • 73
  • 1
  • 1
  • 8
1
vote
1 answer

Struts 2 I am not able to pass

I have a struts 2 that has an action that has to drive to another called "buscarProposta" leading a parameter, but page is giving error. The action must pass the parameter is name = "produtor" type = "redirectAction".