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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:16:08+00:00 2026-05-28T11:16:08+00:00

hi I am new in Struts2 and want to send parameter from one action

  • 0

hi I am new in Struts2 and want to send parameter from one action to other on redirection

My form is like

<s:form action="saveComment">
                            <s:push value="ai">
                                <s:hidden name="id"/>
                                <table cellpadding="5px">
                                    <tr><td><s:textarea name="description" rows="5" cols="60" theme="simple" />
                                        </td>
                                        <td> <s:submit type="image" src="images/sbt.gif"  >
                                             </s:submit>
                                        </td></tr>

                                </table>
                            </s:push>
                        </s:form>

and my struts.xml file is like

 <action name="saveComment" method="saveComment" class="com.weaverants.web.AIAction">

        <result name="success" type="redirect">
            <param name="actionName">displayAI</param>
            <param name="aiId">${aiId}</param>
        </result>

    </action>


   <action name="displayAI" method="displayAI"  class="com.weaverants.web.AIAction">
        <result name="success" >/display_ai.jsp</result>
    </action>
  • 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-05-28T11:16:08+00:00Added an answer on May 28, 2026 at 11:16 am

    You are already passing the parameters in your saveComment all you need to declare result type as redirectAction specifying the action name as the redirectAction and any other needed parameters. like

    <action name="gatherReportInfo" class="...">
          <result name="showReportResult" type="redirectAction">
             <param name="actionName">generateReport</param>
             <param name="namespace">/genReport</param>
             <param name="reportType">pie</param>
             <param name="width">100</param>
             <param name="height">100</param>
             <param name="empty"></param>
    
          </result>
       </action> 
    

    the redirected URL generated will be

     /genReport/generateReport.action?reportType=pie&width=100&height=100
    

    On the other hand using result type as redirect means response is told to redirect the browser to the specified location (a new request from the client).In this case also action instance, action errors, field errors, etc that was just executed is lost and no longer available and only way to pass parameters is by URL or through session

    Same code as stated for redirectAction can be used

    difference between Redirect and actionRedirect is the the first one will use HttpServletResponse#sendRedirect(String) sendRedirect while the later one will be taken care by the struts2 framework by ActionMapper provided by the ActionMapperFactory as is much better to use than Redirect result.

    For passing data beside the URL pattern for these result type you can use

    1. Session to persist data between Action redirect.
    2. ScopeInterceptor.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want Tiles to resolve ognl from the struts2 value stack. How to do
I am new to Struts . I downloaded Struts2 from its website. Now I
I want to generate xml file from Struts action object. So that I have
I am new to Struts2 and would want to understand how exactly does it
In my struts2 application I want to open a new window when user click
I'm new to Struts2, coming from a PHP background, where I'd often have the
I'm new to struts2 and confused by the '#','%' and '$' element. There are
I'm relatively new to Struts2. I've started using ModelDriven to reduce overhead in development.
In struts2 version 2.1.x there is a new UnknownHandler that kicks in when a
I'm developing new web app with Struts2 framework, eclipse, and I've mapped the db

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.