Questions tagged [actioncontext]

The ActionContext is a Struts 2 container for objects needed by the application when the action is executed.

The ActionContext is a Struts 2 container for objects needed by the application when the action is executed. An action context used to access those objects during the the action execution. When Struts2 request is handled by the framework it creates an ActionContext and populate it with the framework core objects, such as request, session, application, valueStack, servlet context objects, parameters, locale, etc. The benefit of this is there's no need to worry about a user specific action context, and it could get statically from the class ActionContext which is ThreadLocal in every request.

References:

66 questions
1
vote
2 answers

Getting ActionContext of an action from another

Can I get an ActionContext or ActionDescriptor or something that can describe a specific action based on a route name ? Having the following controller. public class Ctrl : ControllerBase { [HttpGet] public ActionResult Get() { ... } …
user9124444
1
vote
1 answer

Get a specific parameter sent from view in interceptor

Currently using this code to fetch value of the parameter "csrfPreventionSalt" of Interceptor in Struts2. Can anyone please tell a direct way to fetch its value... public String intercept(ActionInvocation invocation) throws Exception { final…
1
vote
1 answer

Why we can't use execAndWait interceptor using ServletActionContext?

I have to use loading bar on selected actions in Struts2, & am using ServletActionContext, but getting NullPointerException. ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST); If I remove execAndWait interceptor from xml…
1
vote
1 answer

Struts2 JUnit ActionContext objects

Struts ActionContext is null during test. Using Struts2 JUnit plugin I have the following test: public class MainActionIT extends StrutsJUnit4TestCase { @Test public void testAction() { Map application = new HashMap
dingdingding
  • 1,411
  • 1
  • 15
  • 23
1
vote
1 answer

How to add data in JavaScript and bind it to jQuery grid

I have a form whose value get stored in the database on click of submit button. Also there are 4 fields whose data is to be displayed into the struts2-jquery-grid. I first used a temporary table to save values and display those values in the grid.…
Pradnya
  • 649
  • 2
  • 6
  • 17
1
vote
2 answers

How to print session attributes in JSP with Struts 2

Here is what I have: Java class (adding user): public String addUser() throws NoSuchAlgorithmException { HttpSession currentSession = request.getSession(); User u = new User(); u.setUname(getUserName()); …
user3798114
  • 15
  • 1
  • 1
  • 4
1
vote
2 answers

Customized Logging interceptor with bean value in Struts 2

I am writing a customized interceptor for audit logs purpose. I want to get session attributes and request attributes in interceptor. For example: I'll set Username into session and that I am getting too. But the challenge is: I am defining one bean…
1
vote
1 answer

Is it possible to configure unified format of date format for whole struts webapp?

In any case I get exception Could not parse date. There is unified company standard of date format - 'dd/MM/yyyy' There are computers with different system locales. I am using jQueryUI for datepicker ( it is standard for widgets and already settled…
simar
  • 1,782
  • 3
  • 16
  • 33
1
vote
1 answer

struts2 and jaxb for versions of struts2 higher than 2.0.x

Is there some kind of plugin like the struts2-jaxb-plugin that works for versions of struts2 higher than version 2.0.x? The newer versions of struts2 no longer have the get(Object o) on the Class com.opensymphony.xwork2.ActionContext . If there is…
stefaan dutry
  • 1,096
  • 1
  • 10
  • 21
1
vote
0 answers
1
vote
0 answers

Tabular data struts

I tried to capture data from a master-detail form return an JSON object as follows my form is mimilar this http://www.vitarara.org/cms/struts_2_cookbook/creating_a_theme I followed this guide http://struts.apache.org/2.1.6/docs/tabular-inputs.html I…
cardaba713
  • 63
  • 7
1
vote
3 answers

Struts2 access ActionContext from jsp using property tag

I have been looking up this information for a while, but does not seem like there is much online. To make it simple, how do we access the ActionContext through the tag? Basically I want to get the…
AbSoLution8
  • 1,203
  • 1
  • 18
  • 27
1
vote
1 answer

Struts2 session expired

I am using struts2jquery grid plugin for my app. I am using interceptor for session timeout and I am configuring my session timeout in web.xml, But the problem is after session timeout it is not going to required page say login.jsp , my struts.xml…
ppb
  • 2,299
  • 4
  • 43
  • 75
1
vote
1 answer

(Struts2) How to add new parameters into Action instance from an interceptor?

I want to make an interceptor to pre-process XML request. In this interceptor, it parse the XML and put the processed info into ValueStack so that it can map to the instance in the action. However, I have tried so many methods but none of them is…
PatYuen
  • 11
  • 1
  • 3
0
votes
1 answer

Getting execution method annotations in a interceptor

I have some actions that requires a specific user permission to be accessed, so I created a method annotation @RequiredPermission and a interceptor to verify if the method that is going to be executed have or not the annotation and if it have verify…
Guedes
  • 189
  • 8