Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7860201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:11:29+00:00 2026-06-02T22:11:29+00:00

My questions are: In Struts2, does every action object have its own corresponding ActionContext

  • 0

My questions are:

  1. In Struts2, does every action object have its own corresponding ActionContext and ValueStack?

In other words, for every new request a new action object is created. Does this mean every time a new action object is created, a new ActionContext and ValueStack also get created?

  1. Consider this scenario:

Action1——1st req——->view.jsp——2nd req———>action2.

So when a request comes for action1 a new object of action1 and corresponding ActionContext and ValueStack will get created.

From view.jsp (upon clicking hyperlink) a new request goes for action2.

Does this mean that previous ActionContext and ValueStack (related to action1) gets destroyed and a new ActionContext and ValueStack (for action2) gets created?

  1. Suppose I store something in ActionContext (of action1) in view.jsp and then click on hyperlink for action2 (from view.jsp), will that data along with the ActionContext (of action1) get lost?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:11:31+00:00Added an answer on June 2, 2026 at 10:11 pm
    1. Yes
    2. Yes after action execution clean up will be done.

      //SourceCode from StrutsPrepareAndExecuteFilter.
      
      //Cleans up a request of thread locals
      
      public void cleanupRequest(HttpServletRequest request) {
      
        Integer counterVal = (Integer) request.getAttribute(CLEANUP_RECURSION_COUNTER);
        if (counterVal != null) {
            counterVal -= 1;
            request.setAttribute(CLEANUP_RECURSION_COUNTER, counterVal);
            if (counterVal > 0 ) {
                if (log.isDebugEnabled()) {
                    log.debug("skipping cleanup counter="+counterVal);
                }
                return;
            }
        }
      
        // always clean up the thread request, even if an action hasn't been executed
        ActionContext.setContext(null);
        Dispatcher.setInstance(null);
      }
      

    3.Yes, If you want that data available in the next action use chain(not suggestible).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for a bunch of Struts2 / JSP questions, but I have a table
I am developing a new web application with Struts2, Spring and Hibernate as its
I'm new to Struts2, coming from a PHP background, where I'd often have the
2 questions: Does using MVC make it any easier to build 508/WAI compliant sites?
I am new to strut 2 though I have worked on struts 1.2.In one
I'm getting the following error: javax.servlet.jsp.JspException: Broken pipe Now I have seen questions/answers with
I have two questions regarding jsTree: I am generating a jsTree using JSON with
we are using Struts2 in our code and I have scenario where I need
i have 2 questions: 1)I want to separate Enter your Name in <td> and
In the line of Questions every good Java/Java EE Developer should be able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.