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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:23:58+00:00 2026-06-07T04:23:58+00:00

I’m working on a simple UI through which users can add a message to

  • 0

I’m working on a simple UI through which users can add a message to our announcement system.

They enter details onto addMessage.jsp, review the results on reviewMessage.jsp, and then submit from reviewMessage.jsp, where the information will be sent to a database via stored procedure.

Everything works fine, until the user gets to the submit from the review page. When execution leaves the JSP and re-enters the Action class, the message bean has become null. How do I persist the bean through multiple methods and pages in the same action?

Here’s a snippet of my struts.xml file:

<!--Render message entry page-->
<action name="activateMessageInitial"
    class="org.mycompany.struts.action.ActivateMessageAction" method="execute">
    <result name="success">/addMessage.jsp</result>
</action>

<!--Receive message bean fields, adjust their results for storage, render review page-->        
<action name="segmentMessage"
    class="org.mycompany.struts.action.ActivateMessageAction" method="parseAndSegment">
    <result name="failed">/addMessage.jsp</result>
    <result name="success">/reviewMessage.jsp</result>
</action>

<!--Review complete, break message bean into fields to submit to database, then return to main menu-->      
<action name="submitMessage"
    class="org.mycompany.struts.action.ActivateMessageAction" method="activate">            
    <result name="success" type="redirectAction">main</result>
</action>   

And an obfuscated ActivateMessageAction class:

private TargetedMessage messageBean;

public String execute() throws Exception 
{           
    //empty method  
}

//Take the provider message bean, adjust any values as necessary, and then add in the segmentation detail.
public String parseAndSegment() throws Exception    
{       
    //adjust bean fields
}

//Take a completed provider message bean and send it to the database for processing.
public String activate()
{

    //send bean to database; null, here, hence the error.
    ActivateMessageModel.createMessage(messageBean);    
}

public void setMessageBean(TargetedMessage messageBean)
{
    this.messageBean = messageBean;
}

public TargetedMessage getMessageBean()
{
    return messageBean;
}
  • 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-07T04:24:01+00:00Added an answer on June 7, 2026 at 4:24 am

    The lifecycle of an action is limited to a single HTTP request. You can either pass the data as hidden form fields or store the object in session.

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

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.