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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:31:25+00:00 2026-06-17T22:31:25+00:00

I’m newbie to Struts2 framework and i didn’t really have much time to read

  • 0

I’m newbie to Struts2 framework and i didn’t really have much time to read any Struts2 books. I just learn it from YouTube. Anyway here’s my question.

Supposedly my struts.xml is as per below:

<struts>
<package name="p1" namespace="/" extends="struts-default">
    <action name="login" class="org.tutorial.struts2.action.LoginAction">
        <result name="success"  type="redirect" >searchTutorialForm</result>
        <result name="error">/login.jsp</result>
    </action>
    <action name="searchTutorialForm">
        <result>/searchForm.jsp</result>
    </action>
</package>  
</struts>

Lets talk about package p1.

If the URL is say [http://localhost:8080/Struts2/login], the org.tutorial.struts2.action.LoginAction gets called and upon success it gets redirected to the searchTutorialForm action tag which calls the searchForm.jsp.

So the URL the client would see is [http://localhost:8080/Struts2/searchTutorialForm]
(purpose is not for the client to see [http://localhost:8080/Struts2/searchForm.jsp])

Now there are some member variables in LoginAction which is being displayed in searchForm.jsp using tag. However using this approach they are not displayed since i think the object LoginAction is no longer in the ValueStack (after the redirect, i think??).

Of course if i do not use the above approach but instead as per below:

<struts>
<package name="p1" namespace="/" extends="struts-default">
    <action name="login" class="org.tutorial.struts2.action.LoginAction">
        <result name="success">/searchForm.jsp</result>
        <result name="error">/login.jsp</result>
    </action>
</package>  
</struts>

then the member variable in the LoginAction object is displayed in success.jsp using the tag (but then user would see the URL [http://localhost:8080/Struts2/searchForm.jsp])

Basically my intention is for the user not to see any specific internal file or calling like .jsp or .action.

IMPORTANT NOTE:
There is no action class in action tag searchTutorialForm – basically a dummy action.

Question:
1. How do i display the member variable in LoginAction object using the first approach?
2. What is the life cycle of the LoginAction object in Value Stack?

Thanks.

  • 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-17T22:31:27+00:00Added an answer on June 17, 2026 at 10:31 pm
    • Actions are created per-request.
    • A redirect causes a new request.
    • Therefor objects in previous actions are no longer available.

    The questions:

    1. You put it in session or include them as parameters in the redirect.
    2. Actions go away at the end of the request.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a text area in my form which accepts all possible characters from
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

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.