You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pham Anh Tuan <an...@ichi-corp.jp> on 2006/04/12 08:42:20 UTC

[URGEN] Validation in Action and using redirection to view result page :(

Hi all,

case:
I use Tiles and Velocity for presentation layer

com.project.GeneratedKeyAction: will generated and register information of code or capcha (or do something here - retrieve list of user type from DB, etc) to session scope.
  <!-- go to Information & Registration page - this page include registration information and registration form -->
  <action path="/rw/gotoInfoPage"
   type="com.project.GeneratedKeyAction" scope="request"
   validate="false">
   <forward name="success" path="aInfoPage"/>
  </action>

after user fullfill registration form, he/she submits this form with action /rw/processRegForm.do
  <!-- process registration -->
  <action name="regFormBean" path="/rw/processRegForm"
   type="com.project.ProcessRegistration" scope="request"
   validate="false">
   <forward name="success" path="/rw/gotoInfoPage.do" redirect="true" />
   <forward name="failure" path="/rw/gotoInfoPage.do" redirect="true" />
   <forward name="systemFailure" path="aLoi"/>
  </action>

as you saw, whether or not this registration process is successfull, I want the use back to the info page (/rw/gotoInfoPage.do), if there's any error messages /successful messages, this will be showed in the info page.

I read Struts document, and it said that, when I use redirection in forward tag, it means all values which I saved in request scope will be empty, but ... If I don't use redirection in forward tag (to forward to the info page - "/rw/gotoInfoPage"), user will see url: /rw/processRegForm.do after the registration process, and if user refresh this page which has the url: /rw/processRegForm.do, errors will occur because there's no form bean or any data to process :( 

but...

I couldn't save all my error message or any  messages in session scope, because, where could I remove that messages from session scope after process was successful :(

Again, plz help me to solve this problem!

thanks in advance :(

bowlkhin

Re: [URGEN] Validation in Action and using redirection to view result page :(

Posted by Michael Jouravlev <jm...@gmail.com>.
If you used one action to accept user input like processRegForm.do,
and another to display the page like showRegForm.do, you could
logically separate input and output phases. See this for some
insights: http://wiki.apache.org/struts/DataEntryForm

Michael.

On 4/11/06, Pham Anh Tuan <an...@ichi-corp.jp> wrote:
> Hi all,
>
> case:
> I use Tiles and Velocity for presentation layer
>
> com.project.GeneratedKeyAction: will generated and register information of code or capcha (or do something here - retrieve list of user type from DB, etc) to session scope.
>   <!-- go to Information & Registration page - this page include registration information and registration form -->
>   <action path="/rw/gotoInfoPage"
>    type="com.project.GeneratedKeyAction" scope="request"
>    validate="false">
>    <forward name="success" path="aInfoPage"/>
>   </action>
>
> after user fullfill registration form, he/she submits this form with action /rw/processRegForm.do
>   <!-- process registration -->
>   <action name="regFormBean" path="/rw/processRegForm"
>    type="com.project.ProcessRegistration" scope="request"
>    validate="false">
>    <forward name="success" path="/rw/gotoInfoPage.do" redirect="true" />
>    <forward name="failure" path="/rw/gotoInfoPage.do" redirect="true" />
>    <forward name="systemFailure" path="aLoi"/>
>   </action>
>
> as you saw, whether or not this registration process is successfull, I want the use back to the info page (/rw/gotoInfoPage.do), if there's any error messages /successful messages, this will be showed in the info page.
>
> I read Struts document, and it said that, when I use redirection in forward tag, it means all values which I saved in request scope will be empty, but ... If I don't use redirection in forward tag (to forward to the info page - "/rw/gotoInfoPage"), user will see url: /rw/processRegForm.do after the registration process, and if user refresh this page which has the url: /rw/processRegForm.do, errors will occur because there's no form bean or any data to process :(
>
> but...
>
> I couldn't save all my error message or any  messages in session scope, because, where could I remove that messages from session scope after process was successful :(
>
> Again, plz help me to solve this problem!
>
> thanks in advance :(
>
> bowlkhin
>

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


Re: [URGEN] Validation in Action and using redirection to view result page :(

Posted by 王曾wang_zeng <wa...@gmail.com>.
You worry too much! You can use forward. Even if the user refresh the page
when the url dosen't corresponds to the current page, no big problem will
occur. the IE will resend the data that is collected from the previous page
to the server. The only thing will happen is the error-messages showing page
will be shown again.

 >>user will see url:
> >> /rw/processRegForm.do after the registration process, and if user
> refresh
> >> this page which has the url: /rw/processRegForm.do, errors will occur
> >> because there's no form bean or any data to process :( but...
> >>
>

Re: [URGEN] Validation in Action and using redirection to view result page :(

Posted by Pham Anh Tuan <an...@ichi-corp.jp>.
oh, thank you for your help, I will try to use it, again, thank you :)
----- Original Message ----- 
From: "Adam Hardy" <ah...@cyberspaceroad.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, April 12, 2006 7:03 PM
Subject: Re: [URGEN] Validation in Action and using redirection to view 
result page :(


> Hi bowlkhin,
>
> the approach that I used is this:
>
> I have a JSP tile which just contains the HTML for errors and messages 
> display.
>
> I put a scriptlet in this tile after the errors and messages tags.
>
> The scriptlet removes the error or message from the session.
>
> Hope that helps.
>
> Adam
>
> Pham Anh Tuan on 12/04/06 07:42, wrote:
>> Hi all,
>>
>> case:
>> I use Tiles and Velocity for presentation layer
>>
>> com.project.GeneratedKeyAction: will generated and register information 
>> of code or capcha (or do something here - retrieve list of user type from 
>> DB, etc) to session scope.
>>   <!-- go to Information & Registration page - this page include 
>> registration information and registration form -->
>>   <action path="/rw/gotoInfoPage"
>>    type="com.project.GeneratedKeyAction" scope="request"
>>    validate="false">
>>    <forward name="success" path="aInfoPage"/>
>>   </action>
>>
>> after user fullfill registration form, he/she submits this form with 
>> action /rw/processRegForm.do
>>   <!-- process registration -->
>>   <action name="regFormBean" path="/rw/processRegForm"
>>    type="com.project.ProcessRegistration" scope="request"
>>    validate="false">
>>    <forward name="success" path="/rw/gotoInfoPage.do" redirect="true" />
>>    <forward name="failure" path="/rw/gotoInfoPage.do" redirect="true" />
>>    <forward name="systemFailure" path="aLoi"/>
>>   </action>
>>
>> as you saw, whether or not this registration process is successfull, I 
>> want the use back to the info page (/rw/gotoInfoPage.do), if there's any 
>> error messages /successful messages, this will be showed in the info 
>> page.
>>
>> I read Struts document, and it said that, when I use redirection in 
>> forward tag, it means all values which I saved in request scope will be 
>> empty, but ... If I don't use redirection in forward tag (to forward to 
>> the info page - "/rw/gotoInfoPage"), user will see url: 
>> /rw/processRegForm.do after the registration process, and if user refresh 
>> this page which has the url: /rw/processRegForm.do, errors will occur 
>> because there's no form bean or any data to process :( but...
>>
>> I couldn't save all my error message or any  messages in session scope, 
>> because, where could I remove that messages from session scope after 
>> process was successful :(
>>
>> Again, plz help me to solve this problem!
>>
>> thanks in advance :(
>>
>> bowlkhin
>
>
> ---------------------------------------------------------------------
> 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


Re: [URGEN] Validation in Action and using redirection to view result page :(

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Hi bowlkhin,

the approach that I used is this:

I have a JSP tile which just contains the HTML for errors and messages 
display.

I put a scriptlet in this tile after the errors and messages tags.

The scriptlet removes the error or message from the session.

Hope that helps.

Adam

Pham Anh Tuan on 12/04/06 07:42, wrote:
> Hi all,
> 
> case:
> I use Tiles and Velocity for presentation layer
> 
> com.project.GeneratedKeyAction: will generated and register information of code or capcha (or do something here - retrieve list of user type from DB, etc) to session scope.
>   <!-- go to Information & Registration page - this page include registration information and registration form -->
>   <action path="/rw/gotoInfoPage"
>    type="com.project.GeneratedKeyAction" scope="request"
>    validate="false">
>    <forward name="success" path="aInfoPage"/>
>   </action>
> 
> after user fullfill registration form, he/she submits this form with action /rw/processRegForm.do
>   <!-- process registration -->
>   <action name="regFormBean" path="/rw/processRegForm"
>    type="com.project.ProcessRegistration" scope="request"
>    validate="false">
>    <forward name="success" path="/rw/gotoInfoPage.do" redirect="true" />
>    <forward name="failure" path="/rw/gotoInfoPage.do" redirect="true" />
>    <forward name="systemFailure" path="aLoi"/>
>   </action>
> 
> as you saw, whether or not this registration process is successfull, I want the use back to the info page (/rw/gotoInfoPage.do), if there's any error messages /successful messages, this will be showed in the info page.
> 
> I read Struts document, and it said that, when I use redirection in forward tag, it means all values which I saved in request scope will be empty, but ... If I don't use redirection in forward tag (to forward to the info page - "/rw/gotoInfoPage"), user will see url: /rw/processRegForm.do after the registration process, and if user refresh this page which has the url: /rw/processRegForm.do, errors will occur because there's no form bean or any data to process :( 
> 
> but...
> 
> I couldn't save all my error message or any  messages in session scope, because, where could I remove that messages from session scope after process was successful :(
> 
> Again, plz help me to solve this problem!
> 
> thanks in advance :(
> 
> bowlkhin


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