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 8556169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:17:06+00:00 2026-06-11T15:17:06+00:00

We are using struts 1.2.2 and have a situation here. So we have 2

  • 0

We are using struts 1.2.2 and have a situation here.
So we have 2 forms FormA and FormB.
We also have 2 actions ActionA and ActionB.

Now ActionA when invoked it gets FormA as the submitted bean. It does all processing, saves the form , creates an OrderId and if successful it forwards to ActionB. ActionB then populates FormB based on the OrderId and then forwards to the next jsp.

We don’t want the 2 actions to share a form as the contents are very different and we want the forms to only represent what it represents on the jsp page. Also on every page we are saving the content on the Db. The flow has 5 pages and one can leave after 2 pages – come back again and start from page 1. But page 1 and page 2 should retrieve the data from the DB and display. So if an orderID exists we populate the form based on that orderId by fetching data from the DB.

However I don’t find an easy way of passing this orderId from one action to another.

I can’t use request.setAttribute() at the end of ActionA as by the time the control reaches ActionB it now has a completely new Request Object. I am guessing on the forward that happens from one action to another the request gets refreshed. However if it forwards to a jsp the request is retained.

Don’t want to store the orderId in session as session.setAttribute() as someone may attempt a bookmarked URL and then that page would simply pick up the last stored OrderId in session and try to process that.

Also no way we can put that in formbeans as that is not shared.

One option is to pass that in the URL as a param e.g. ActionB?OrderId=89 . However downside to that is someone can change the orderId in the URL and try to fetch data for that random orderId. While we can always put in checks to prevent someone not authorized to view a order that belongs to another customer it is a convoluted process at the moment. Also in Struts 1.2.2 I think I will have to create a new ActionForward object programmatically and then append “?OrderId=89” explicitly at the end of the current path.

Any help friends?

  • 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-11T15:17:07+00:00Added an answer on June 11, 2026 at 3:17 pm

    Actually, I would put it in the session. Then when you retrieve it from ActionB, just delete it immediately.

    Integer orderId = session.getAttribute("myapp.OrderId");
    session.removeAttribute("myapp.OrderID");
    

    This is typically known as a Flash scoped variable. There is no official Flash scope in Struts, but this simulates it.

    Basically, the fear of reloading the OrderId is gone here because ActionA will set this variable in the session, forward to ActionB and ActionB will get it out of the session and delete it. The only way someone could have that stuck in their session is if they stop the request after ActionA is done but before ActionB runs, which is highly unlikely and would just get removed once they view ActionB anyway, which probably wouldn’t be that bad.

    This also let’s you put in ActionB to check to make sure an OrderID is in the session and, if not, forward back to ActionA.

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

Sidebar

Related Questions

i have legacy j2ee project which is using struts 2 with spring. Now when
I am using Struts and Hibernate for my web application. And also i have
I have started using struts .I have hanged in a place ,Code is bellow
I'm using Spring and struts and have the following entry in '/META-INF/context.xml' <Context cachingAllowed=false
I am using Struts Tiles with JSF to have one header, menu and footer
I am using Struts 1.2.7 and have the standard servlet mapping that uses *.do
I am using Struts and Java. The problem is that I have a page
I am using hibernate, struts, extjs in my project. I have a Customer object
Here is my current situation: I have two tm structs, both set to the
I am using Struts 1 framework and i have a query regarding the logic:iterate

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.