Messages are stored since you use RedirectMessageInterceptor.

Action property Data is not retained during redirect.

Try following scenarios,

 

Method1:

So you need to set explicitly from Action property to ActionContext in
Action1 and Need to retrive from the context and set to properties in
Action2.

Method2:

Try to use alias interceptor and put alias through the <param> tag in
struts.xml  of Action1 and Action2 properties as below.

<param name="aliases">#{ 'action1Property1' : 'action2Property1',
'action2Property2' : 'action2Property2'}</param>

<interceptor-ref name="alias"/>

 

Method3:

Have you tried chain instead of redirectaction and use same properties in
Action1 and Action2.

 

Regards,
Raghuveer Vellanki

 

-----Original Message-----
From: Siddiq Syed [mailto:siddiq...@yahoo.com] 
Sent: Friday, October 30, 2009 1:43 AM
To: user@struts.apache.org
Subject: Re: Preserving Messages and Garbage values Across a Redirect in
Struts 2

 

 

I donno If i can able to explain it to you, I will try my  best , here is
the

secinario

 

 

Step 1.  When the user click the button on the page, depend on the string

return from the action method the page will be display and is configured in

the struts.xml file as mention below.

  

           <action name="determineCaseEvaluationType" 

class="com.activity.EvaluateCaseAction"

method="determineCaseEvaluationType">

            <result name="guidelInitConsid"

type="tiles">editGuidelinesCaseEvaluation</result>

            <result name="shrtsntcInitConsid"

type="tiles">editShortSentenceCaseEvaluation</result>

            <result name="sscat2p1InitConsid"

type="tiles">editShortSentenceCaseEvaluation</result>

        </action>

 

step 2. There are fields in the pages like 10 text boxes 2 drop down and 2

radio buttons , when I fill all the field and click submit it will do the

neccessary business operation and return the string to which page is to

display, and is mention in the struts.xml file as mention below

         

       <action name="saveInitConsiderationEval"

class="com.activity.EvaluateCaseAction"  method="saveInitConsiderationEval">

            <interceptor-ref name="redirectInput"/>

            <result name="success" type="redirect-action">

                  determineCaseEvaluationType

            </result>

            <result name="input" type="redirect-action">

            determineCaseEvaluationTypeForInput

      </result>

        </action>

 

step 3. : when valiations fails I need to determine on which page

validations failed and hence I am forwarding the the input to method which

it will determine what page to be displayed.

 

<action name="determineCaseEvaluationTypeForInput"

class="us.ga.state.pap.cons.clemency.presentation.action.activity.EvaluateCa
seAction"

method="determineCaseEvaluationTypeForInput">

            <result name="guidelInitConsid"

type="tiles">editGuidelinesCaseEvaluation</result>

            <result name="shrtsntcInitConsid"

type="tiles">editShortSentenceCaseEvaluation</result>

            <result name="sscat2p1InitConsid"

type="tiles">editShortSentenceCaseEvaluation</result>

</action>

 

I hope you got the sicenario , Its tofugh to explain whatz going on in the

mind !

 

Thanks

Siddiq.

 

 

Greg Lindholm-2 wrote:

> 

> Still don't understand why you need to redirect on input result.

> 

> Normally when validation fails you want to return the user back to the

> same

> page. If you dispatch back to the input jsp page (instead of redirect)

> then

> all the input parameters will be there so can be redisplayed with the

> error

> messages.

> 

> <result name="input">/myInputPage.jsp</result>

> 

> Maybe if you posted your struts config and gave a more detailed

> explanation

> someone could help you with a better solution.

> 

> 

> On Thu, Oct 29, 2009 at 3:13 PM, Siddiq Syed <siddiq...@yahoo.com> wrote:

> 

>> 

>> Hi Greg,

>> 

>> Thanks for your quick repley,!

>> 

>> The reason for doing a redirect on the input is that system needs to

>> determine what will be the page to display next along with the error

>> messages and the garbage values.

>> 

>> As a temporary solution i am using the getter and setter methods of the

>> variables of View bean ,storing the request values  in a temporary

>> session

>> and retriving it in the redirect method of action. and setting back in

>> the

>> request. -:) which i Guess in not a good approach.

>> 

>> But i Guess there should be some way other than the above.

>> 

>> 

>> Thanks

>> Siddiq.

>> 

>> 

>> Greg Lindholm-2 wrote:

>> >

>> > The short answer is don't redirect when validation fails.

>> >

>> > For results of "input" you should not be doing a redirect or you get

>> the

>> > problem you described.

>> >

>> > On Thu, Oct 29, 2009 at 11:13 AM, Siddiq Syed <siddiq...@yahoo.com>

>> wrote:

>> >

>> >>

>> >> Hi all,

>> >>

>> >> I have been using Glindholm's RedirectMessageInterceptor  to perserve

>> the

>> >> validations/error messages and is working absoulty fine.

>> >>

>> >> But the problem is the values in the fields are not stored.

>> >>

>> >> If a form has 10 fields of which 2 fields are not valid(It does not

>> pass

>> >> validation), Intercerptor displays the error message but doesnot shows

>> >> the

>> >> values in the fields of the form.

>> >>

>> >> I hope you guys got the problem. I don't want the user to enter all

>> the

>> >> values every time even if the validation fails for 1 or 2 field.

>> >>

>> >> Please let me know if you have occured this problem and have the

>> solution

>> >> for the same.

>> >>

>> >> Thanks in advance.

>> >>

>> >> http://glindholm.wordpress.com/

>> >>

>> >>

>> >> Thanks

>> >> Siddiq.

>> >> --

>> >> View this message in context:

>> >>

>>
http://www.nabble.com/Preserving-Messages-and-Garbage-values-Across-a-Redire
ct-in-Struts-2-tp26114968p26114968.html

>> >> Sent from the Struts - User mailing list archive at Nabble.com.

>> >>

>> >>

>> >> ---------------------------------------------------------------------

>> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org

>> >> For additional commands, e-mail: user-h...@struts.apache.org

>> >>

>> >>

>> >

>> >

>> :-((

>> --

>> View this message in context:

>>
http://www.nabble.com/Preserving-Messages-and-Garbage-values-Across-a-Redire
ct-in-Struts-2-tp26114968p26119066.html

>> Sent from the Struts - User mailing list archive at Nabble.com.

>> 

>> 

>> ---------------------------------------------------------------------

>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org

>> For additional commands, e-mail: user-h...@struts.apache.org

>> 

>> 

> 

> 

 

-- 

View this message in context:
http://www.nabble.com/Preserving-Messages-and-Garbage-values-Across-a-Redire
ct-in-Struts-2-tp26114968p26119902.html

Sent from the Struts - User mailing list archive at Nabble.com.

 

 

Reply via email to