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

  • SEARCH
  • Home
  • 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 8448765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:31:04+00:00 2026-06-10T10:31:04+00:00

If I had a typical setup with an action that forwards to the JSP

  • 0

If I had a typical setup with an action that forwards to the JSP I would request my properties like so:

<s:property value="myVariable" />

where myVariable is a variable in the action.

I want to use action tags like this in another page:

<s:action name="actionName" executeResult="false"> 
    <s:param name="switch">true</s:param>
</s:action>

How do I access myVariable when using an action tag like above? I tried <s:property value="myVariable" /> but it doesn’t work.

  • 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-10T10:31:05+00:00Added an answer on June 10, 2026 at 10:31 am

    When you write <s:property value="myVariable" />, Struts looks for the property myVariable in its “Value Stack”. The current action is in the ValueStack, and that’s why the typical setup works. Now, in the case of

    <s:action name="actionName" executeResult="false"> 
        <s:param name="switch">true</s:param>
    </s:action>
    <s:property value="myVariable" />
    

    when the last line is executed the actionName action has already executed, the current action is not that but the main (“outer”) one . If you want to acces properties of your “inner” action, you have several alternatives, two of them are shown in the docs:

    Either add the var attribute so that the executed (inner) action is assigned to a variable and reference it with the # syntax:

    <s:action name="actionName" var="innerAction" executeResult="false">
       <s:param name="switch">true</s:param>
    </s:action>
    <s:property value="#innerAction.myVariable" />
    

    Or, in your action method, add your property value explicitly to some scope ( eg: attribute)

    // in your inner action: 
    ServletActionContext.getRequest().setAttribute("myVariable", "blah blah");
    
    <s:property value="#attr.myVariable" />
    

    Disclaimer: I’ve not tested this

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

Sidebar

Related Questions

All, My typical approach for a medium sized WCF service would be something like:
I've built an upload button that's formatted to look like your typical html button,
I've had this setup, but it didn't seem quite right. How would you improve
Had a page that was working fine. Only change I made was to add
Had a good search here but can't see anything that gets my mind in
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
I had a debate about macros and their readability. I think that in some
Here is a typical function that returns either true/false; private static bool hasValue() {
I'm helping a typical small company that started with a couple of outsourced systems
I know that, under typical conditions, a class is only loaded once. I also

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.