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
9
votes
2 answers

How to determine whether a request is Ajax or Normal?

I want to handle errors differently for AJAX requests vs normal requests. How do I identify whether a request is AJAX or not in Struts2 actions ?
Amol Ghotankar
  • 2,008
  • 5
  • 28
  • 42
8
votes
3 answers

Struts 2: parameters between Actions

I have the following question: I need to pass a parameter (for example ID ) when I finish a form and the action save the form's values, this will forward to the result = "success" and I need that the action that will be call in the success come with…
user95288
8
votes
1 answer

Struts2: method attribute in button doesn't work

I have a form in jsp. There are two submit buttons: "Search" and "Add New" button. I had set each button with their own method attribute.
null
  • 8,669
  • 16
  • 68
  • 98
7
votes
1 answer

Could not find action or result

I am getting: com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn Could not find action or result There is no Action mapped for namespace [/] and action name [] associated with context path [/]. - [unknown location] I am using a…
6
votes
1 answer

Should struts annotation @Result only be in class level or not?

I am reading Struts2 documentation and found that there was kind of contradiction in its documentation. In this link https://struts.apache.org/docs/convention-plugin.html The Convention plugin allows action classes to define different results for…
5
votes
1 answer

Struts 2 - Mapped Actions working with any URL

I am creating a web app with Struts2, and I am having an issue with the mapped actions working with any url. In my struts.xml file, I have configured a package with a namespace of "/registration" with a few actions, with the main one being…
A. Cusano
  • 87
  • 1
  • 7
5
votes
1 answer

Action not mapped error using Struts 2 REST plugin

I have written a simple code to integrate rest with Struts 2.3.24 I have my Struts XML:
Harshal
  • 57
  • 2
5
votes
2 answers

Getting a list of configured actions in Struts2

In a project using Struts2 (2.3.20) I would like to run through the configured actions (name, class, namespace, method) at application startup. I'm using Struts 2.3.20 struts-spring-plugin struts-convention-plugin For reference: I've done some…
Mats
  • 283
  • 4
  • 14
4
votes
1 answer

How To return only array not json object in struts2

commissioner_info\[\d+\]\.fname, …
4
votes
2 answers

How to ignore the root JSON node in struts2 action

I added this method in my struts action, public String execute() { long start = System.currentTimeMillis(); simDetails = new SIMDetails(); return GET_SIM_DETAILS; } and added below action in struts config file,
Said Gamal
  • 65
  • 1
  • 1
  • 13
4
votes
3 answers

Accessing a value in Struts ActionForm from JSP

I am a Struts 1.3.10 newbie and I have an issue where I have an Action called RegistrationAction as follows: public final class RegistrationAction extends Action{ @Override public ActionForward execute(ActionMapping mapping, …
Mr Morgan
  • 2,215
  • 15
  • 48
  • 78
3
votes
4 answers

Struts session form bean doesn't retain state

I am creating a wizard-like interface consisting of 3 jsp pages and 3 Struts actions using Struts 1.3. The flow is like below: page1>action1 ->page2>action2 -> page3>action3 I use a session form bean (an action form with session scope) to share data…
Sandeep
  • 101
  • 1
  • 8
3
votes
1 answer

How to get the Action name in JSP even if it's empty?

I am new to java. I tried to search around but did not find anything similar to my question. I have list items in menu (
    -s and
  • -s) I want to add the active class in
  • tag depending on the action's name to make the specific menu item…
Yasir Wali
  • 39
  • 10
3
votes
0 answers

Different results for different struts2 action suffixes

I want Struts2 action to return different pages based on action suffix. I think it is possible to create a filter that wraps original request and changes URL the way that URL's with different suffixes will be mapped to different actions. But this…
ooops
  • 326
  • 2
  • 14
3
votes
2 answers

what is the differance path type in java struts.xml?

I am new java struts framework. But I want to ask a question. In struts.xml path is .do like "/AddReq.do" OR path is only name like "AddReq" What is difference between "/AddReq.do" and "AddReq" ? For example
Serdar Alkan
  • 181
  • 1
  • 4
  • 15
1
2 3 4 5 6 7