Questions tagged [struts2-interceptors]

Classes invoked by the Struts 2 framework before and after an Action is executed.

Classes invoked by the Struts 2 framework before and after an Action is executed. Struts 2 provides a default stack of interceptors from the Struts 2 core jar which are executed in a specific order.

Detailed description: http://struts.apache.org/release/2.3.x/docs/interceptors.html

137 questions
7
votes
3 answers

Parameters with no mutators and accessors (setters/getters) along with the parameters interceptor in Struts 2

In the following action class, I'm using the parameters interceptor. @Namespace("/admin_side") @ResultPath("/WEB-INF/content") @ParentPackage(value = "struts-default") @InterceptorRefs(@InterceptorRef(value="store", params={"operationMode",…
Tiny
  • 24,933
  • 92
  • 299
  • 571
7
votes
4 answers

Get HttpServletRequest in Struts 2 interceptor

To get the HttpServletRequest in an interceptor I used below code: HttpServletRequest request =(HttpServletRequest) ActionContext.getContext().get(HTTP_REQUEST); I tried to implement ServletRequestAware in the interceptor but it did not worked. Are…
Alireza Fattahi
  • 33,509
  • 12
  • 96
  • 140
6
votes
2 answers

Unexpected Exception caught setting 'xxx' on 'class xxx: Error setting expression 'xxx' with value ['x', ]

I'm passing some parameters to an action class implementing ModelDriven through a query-string.
Tiny
  • 24,933
  • 92
  • 299
  • 571
5
votes
2 answers

How to implement CSR forgery prevention code on Struts2?

I added an interceptor to my struts.xml and to all of the forms to prevent Cross-site Request Forgery attacks. I am wondering if I should do anything else? Such as retrieving the token and matching with the one submitting along with forms, in case…
Jack
  • 5,526
  • 22
  • 68
  • 141
4
votes
5 answers

Struts 2 Session in interceptor

I am trying to access session object from within my interceptor by implementing SessionAware interface (I've implemented the setSession method), but I am not able to get my session object this way. Then I tried…
Sachin Midha
  • 958
  • 2
  • 7
  • 11
4
votes
1 answer

How to use different validate methods in one action class in Struts 2

I have an action class and it has two action methods in it. I want separate validate methods for it. I am new to Struts2. I want something like this. I think it can be implemented by validation interceptor but how? public class…
Vivek Mishra
  • 1,535
  • 1
  • 14
  • 32
4
votes
1 answer

Performing CRUD operations in an action class along with the prepare() method in Struts2

Assuming the following action class. @Namespace("/admin_side") @ResultPath("/WEB-INF/content") @ParentPackage(value="struts-default") public final class TestAction extends ActionSupport implements Serializable, ValidationAware, Preparable { …
Tiny
  • 24,933
  • 92
  • 299
  • 571
4
votes
1 answer

i18n Interceptor usage in Struts2

I want to make a site multilingual. I have an normal interceptor stack which contains A common jsp for changing locale:
Alireza Fattahi
  • 33,509
  • 12
  • 96
  • 140
4
votes
1 answer

User session getting mixed up on tomcat

We are using Tomcat 6.29 behind IIS7.5, with spring, hibernate and struts2 framework. We are now beginning to notice that the server sessions are getting mixed up especially in Ajax request. More details about the problem User 1 requests page1,…
4
votes
1 answer

Struts 2 Validation using Message Store Interceptor

I have an action where I am trying to log the user in. public class RegisteredUserAction extends ActionSupport implements SessionAware { .. .. public String login() throws Exception { DBLogic dBLogic = new DBLogic(); RegisteredUser…
3
votes
1 answer

Subscription design pattern : Spring

I am building a cloud based applications using spring, spring security, hibernate and Oauth. It has different products and each product has multiple modules. Modules also have multiple functionality. Clients has to subscribe to each product…
3
votes
1 answer

How can I configure HTTP Response Headers in a Struts2 Interceptor?

We currently have a java web application in the middle of migration from Struts 1 to Struts 2. We would like to configure X-Frame-Options and Content-Security-Policy headers for all our Struts 2 actions. We have a lot of actions and I want to avoid…
Nzall
  • 3,189
  • 4
  • 25
  • 57
3
votes
1 answer

Struts 2 Acion class multiple instance

I load object userData like below, to show it on JSP. (later it will be loaded from database) using Register() method type GET. Next I fill another fields of userData on JSP and click register. Then method Register() start again, but not use this…
lucas999
  • 129
  • 1
  • 11
3
votes
1 answer

WARN: Parameter didn't match accepted pattern in Struts 2

I'm using Struts2.3.28. When I submit a form which uses the submit tag with the method attribute, I'm getting this warning: WARN com.opensymphony.xwork2.interceptor.ParametersInterceptor warn- Parameter [method:save] didn't match accepted …
leonbloy
  • 65,169
  • 19
  • 130
  • 176
3
votes
0 answers

Struts2 Session cluster - Issue with non serialized object - when TokenSessionInterceptor is used(2.3.16) version

I am trying to configure, Session clustering for one of my struts2 based application, but it fails if I use TokenSessionInterceptor in application. Following error is observed in logs when session persistence is in…
1
2 3
9 10