You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Siddiq Syed <si...@yahoo.com> on 2010/03/05 22:37:50 UTC

Struts 2 Validations values restore.

Hi all,

The only part that I hate most is validation in struts 2. Rest of the things
falls in right place.

When client side validations happens and the validation messages have to be
displayed in the page that need to be determined form the action., i.e
redirect-action on INPUT.

Here is the example what I am trying to do.

<action name="complete" class="com.xyz">
   <result name="success" type="tiles">abc.jsp</result>
   <result name="input" type="redirect-action">
       cnn
    </result>
</action>

<action name="cnn" class="com.xyz">
  <result name="nbc" type="tiles">nbc.jsp</result>
  <result name="gma" type="tiles>gma.jsp</result>
</action>

When I click complete button by entering some garbage(validating) values
following steps happens,

1. getter ,setter methods will be called 
2. validation check than happen
3. validation message can be capture in a session , so that it can be
forwarded to the action using the following interceptor
http://struts.apache.org/2.1.8.1/docs/message-store-interceptor.html
http://glindholm.wordpress.com/category/struts-2/
4. I can able to display the validations messages but the problem is all the
garbage values that I enter will not be display back in the respective input
fields.

I know i have this post many a times in this forum, but still I didn't got
the concreate solution for this.

Do any one body have any idea how can we populate back the values, or is
there any interceptor that store the request values and forwards the request
values for the another action.

I tried several temporary solutions,
i) by storing the request values in the tempsession variable and the copying
back in the another request.
ii) by trying chaining the request (chain interceptor )
iii) by implementing the preparable interface , prepare method.
vi) by impelenting prepareDoMethod....().

Any thoughts or prior experience please share .

Thanks
Siddiq.
-- 
View this message in context: http://old.nabble.com/Struts-2-Validations-values-restore.-tp27799499p27799499.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 Validations values restore.

Posted by Siddiq Syed <si...@yahoo.com>.


adam pinder wrote:
> 
> You don't redirect on validation errors.
> A jsp page form is associated with an action, the same jsp is  
> displayed on validation errors then the action and jsp will re-  
> display the erroneous values automatically. Redirect on success is  
> more common.
> 
> Adam
> 
> On 5 Mar 2010, at 21:37, Siddiq Syed <si...@.com> wrote:
> 
>>
>> Hi all,
>>
>> The only part that I hate most is validation in struts 2. Rest of  
>> the things
>> falls in right place.
>>
>> When client side validations happens and the validation messages  
>> have to be
>> displayed in the page that need to be determined form the action., i.e
>> redirect-action on INPUT.
>>
>> Here is the example what I am trying to do.
>>
>> <action name="complete" class="com.xyz">
>>   <result name="success" type="tiles">abc.jsp</result>
>>   <result name="input" type="redirect-action">
>>       cnn
>>    </result>
>> </action>
>>
>> <action name="cnn" class="com.xyz">
>>  <result name="nbc" type="tiles">nbc.jsp</result>
>>  <result name="gma" type="tiles>gma.jsp</result>
>> </action>
>>
>> When I click complete button by entering some garbage(validating)  
>> values
>> following steps happens,
>>
>> 1. getter ,setter methods will be called
>> 2. validation check than happen
>> 3. validation message can be capture in a session , so that it can be
>> forwarded to the action using the following interceptor
>> http://struts.apache.org/2.1.8.1/docs/message-store-interceptor.html
>> http://glindholm.wordpress.com/category/struts-2/
>> 4. I can able to display the validations messages but the problem is  
>> all the
>> garbage values that I enter will not be display back in the  
>> respective input
>> fields.
>>
>> I know i have this post many a times in this forum, but still I  
>> didn't got
>> the concreate solution for this.
>>
>> Do any one body have any idea how can we populate back the values,  
>> or is
>> there any interceptor that store the request values and forwards the  
>> request
>> values for the another action.
>>
>> I tried several temporary solutions,
>> i) by storing the request values in the tempsession variable and the  
>> copying
>> back in the another request.
>> ii) by trying chaining the request (chain interceptor )
>> iii) by implementing the preparable interface , prepare method.
>> vi) by impelenting prepareDoMethod....().
>>
>> Any thoughts or prior experience please share .
>>
>> Thanks
>> Siddiq.
>> -- 
>> View this message in context:
>> http://old.nabble.com/Struts-2-Validations-values-restore.-tp27799499p27799499.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Struts-2-Validations-values-restore.-tp27799499p27801901.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 Validations values restore.

Posted by Adam Pinder <ap...@hotmail.co.uk>.
You don't redirect on validation errors.
A jsp page form is associated with an action, the same jsp is  
displayed on validation errors then the action and jsp will re-  
display the erroneous values automatically. Redirect on success is  
more common.

Adam

On 5 Mar 2010, at 21:37, Siddiq Syed <si...@.com> wrote:

>
> Hi all,
>
> The only part that I hate most is validation in struts 2. Rest of  
> the things
> falls in right place.
>
> When client side validations happens and the validation messages  
> have to be
> displayed in the page that need to be determined form the action., i.e
> redirect-action on INPUT.
>
> Here is the example what I am trying to do.
>
> <action name="complete" class="com.xyz">
>   <result name="success" type="tiles">abc.jsp</result>
>   <result name="input" type="redirect-action">
>       cnn
>    </result>
> </action>
>
> <action name="cnn" class="com.xyz">
>  <result name="nbc" type="tiles">nbc.jsp</result>
>  <result name="gma" type="tiles>gma.jsp</result>
> </action>
>
> When I click complete button by entering some garbage(validating)  
> values
> following steps happens,
>
> 1. getter ,setter methods will be called
> 2. validation check than happen
> 3. validation message can be capture in a session , so that it can be
> forwarded to the action using the following interceptor
> http://struts.apache.org/2.1.8.1/docs/message-store-interceptor.html
> http://glindholm.wordpress.com/category/struts-2/
> 4. I can able to display the validations messages but the problem is  
> all the
> garbage values that I enter will not be display back in the  
> respective input
> fields.
>
> I know i have this post many a times in this forum, but still I  
> didn't got
> the concreate solution for this.
>
> Do any one body have any idea how can we populate back the values,  
> or is
> there any interceptor that store the request values and forwards the  
> request
> values for the another action.
>
> I tried several temporary solutions,
> i) by storing the request values in the tempsession variable and the  
> copying
> back in the another request.
> ii) by trying chaining the request (chain interceptor )
> iii) by implementing the preparable interface , prepare method.
> vi) by impelenting prepareDoMethod....().
>
> Any thoughts or prior experience please share .
>
> Thanks
> Siddiq.
> -- 
> View this message in context: http://old.nabble.com/Struts-2-Validations-values-restore.-tp27799499p27799499.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org