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
0
votes
1 answer

Struts2 request as null

Very strange error I have, I am getting request as null when I try to access it. I always used the same method to get it, but now I am having this error. My Action look like this: package com.deveto.struts.actions; import…
Denees
  • 9,100
  • 13
  • 47
  • 76
0
votes
2 answers

Struts2 :Is there any scenario where a Action class requires HttpServletRequest object

I have read this below para from a website : When a Action class requires objects such as the HttpServletRequest ,that can be obtained by asking the ActionContext or implementing ServletRequestAware. Could anybody please tell me any scenario where…
user663724
0
votes
1 answer

override OnActionExecuting by HttpActionContext in .NET Core

I have a old MVC program web api with [ValidateModel] attribute: [Route("login")] [ValidateModel] public User Login(LoginModel model) { } Validate the model by code below and return with custom response: public class ValidateModelAttribute :…
0
votes
1 answer

Problems with Login application in struts2

I am trying to write small login application in struts 2.Session is b eing created successfully.In welcome.jsp "logout" option is given.On logout control will be redirected to Logout.jsp. My problem is after logout session…
Jagan
  • 4,649
  • 19
  • 60
  • 70
0
votes
1 answer

Right way to read range header from IHeaderDictionary object

I have an ActionContext object. I want to read the Range header from the Request. What I know is that I can read it like this var rangeHeader = context.HttpContext.Request.Headers["Range"] but then I have to split the string to get range from and…
Pawan Nogariya
  • 8,330
  • 12
  • 52
  • 105
0
votes
0 answers

Ajax response contains struts2 tags which are not translated

I am using an ajax request that constructs a modal box on the server side. The content of the modal box will contain a "calculated" link, surrounded with a form : StringBuffer htmlBuffer = new StringBuffer(); htmlBuffer.append( ... ""+ "
0
votes
2 answers

Get username on ActionExecutedContext for MVC?

How can I get the name of the currently logged in user in MVC? I tried below codes I can get date and methodname but not get user name. public void OnActionExecuted(ActionExecutedContext filterContext) { AcibademUniversitesiDBEntities model =…
0
votes
2 answers

Most standard way to implement sessions in strtuts2

I was looking for ways of implementing sessions in struts2. I found 1) Just use getSession() on apache Map session = ActionContext.getContext().getSession(); 2) Using SessionAware on javapoint Instead of plain map, it uses SessionMap which is a…
Varun Garg
  • 2,464
  • 23
  • 37
0
votes
3 answers

How many sessions can be managed by an Java Application in Struts 2?

I am working on Transaction Management application, and I am using Struts2. I have used internally a session for setting and getting values like ActionContext.getContext().getSession().put("string", string); Is there any limit or any disadvantage…
Himanshu Sharma
  • 79
  • 1
  • 4
  • 12
0
votes
1 answer

What's the purpose of storing objects directly to the ValueStack/ActionContext?

Based from what I've researched, I've seen that tags such as , or by creating an are able to insert references directly to the ActionContext or ValueStack. This confuses me a lot because why can't you just have one dedicated…
mpmp
  • 2,409
  • 4
  • 33
  • 46
0
votes
0 answers

Setting the session property of Actioncontext in the home.jsp

By default if i have a struts homepage which is home.jsp which can be something like: <%@taglib uri="/struts-dojo-tags" prefix="sd" %> <%@taglib uri="/struts-tags" prefix="s" %>
jayendra bhatt
  • 1,337
  • 2
  • 19
  • 41
0
votes
1 answer

StrutsSpringTestCase - Several contexts - How to instantiate them properly in order

I am writing integration test cases for the project that uses Struts2, Spring, Hibernate using JUnit. My test class extends StrutsSpringTestCase. The application needs login/session to invoke any action. Following is the code: @Test public void…
Kevin Rave
  • 13,876
  • 35
  • 109
  • 173
0
votes
1 answer

Scopes of ActionMapper, ActionProxy, ActionInvocation, ActionContext objects in Struts2?

Can any one please describe me when the objects of ActionMapper, ActionProxy, ActionInvocation, ActionContext are created in a Struts2 application. As I am new to Struts2 framework, I am very much confused about the scopes of these objects.
0
votes
2 answers

Is ActionContext in Struts 2 unique to the current request?

I'm using a custom interceptor which creates a new db connection, and sets this connection onto the current action before executing the action. After that, the interceptor closes the connection. I'm looking for a convenient way to share this db…
Ali
  • 261,656
  • 265
  • 575
  • 769
0
votes
3 answers

How to set locale dinamically via code in Struts 2

In my application, I have to display the content based on the locale that an user has chosen in the configuration page. I am not using a browser default locale. when using , it always use the default resource file. In Struts1, I have used…
john
  • 859
  • 2
  • 12
  • 25