You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Puneet Lakhina <pu...@gmail.com> on 2006/10/27 13:37:28 UTC

Retain Form Bean

hi,
I have the following scenario. I have a form that takes certain input. This
in effect goes through certain validations. Now what I want to do is in case
of validation errors a seprarte page is displayed that lists all the errors,
and asks the user to continue submitting the data ignoring the errors, or to
go back to the form and change the data.
My question is how do i submit the data from my error page (which is a
different page), in case the user chooses to continue to submit ignoring the
errors.

So the flow is like this

form submit-> if errors - >error page - >if continue ->submit data and store
in Database.

This continue functionality is what im unable to achieve because I dont know
how to resubmit the same form values from the error page.

Any clues??

-- 
Puneet

Re: Retain Form Bean

Posted by Laurie Harper <la...@holoweb.net>.
Puneet Lakhina wrote:
> On 10/28/06, Laurie Harper <la...@holoweb.net> wrote:
>>
>> Puneet Lakhina wrote:
>> > hi,
>> > I have the following scenario. I have a form that takes certain input.
>> This
>> > in effect goes through certain validations. Now what I want to do is in
>> > case
>> > of validation errors a seprarte page is displayed that lists all the
>> > errors,
>> > and asks the user to continue submitting the data ignoring the errors,
>> > or to
>> > go back to the form and change the data.
>> > My question is how do i submit the data from my error page (which is a
>> > different page), in case the user chooses to continue to submit 
>> ignoring
>> > the
>> > errors.
>> >
>> > So the flow is like this
>> >
>> > form submit-> if errors - >error page - >if continue ->submit data and
>> > store
>> > in Database.
>> >
>> > This continue functionality is what im unable to achieve because I dont
>> > know
>> > how to resubmit the same form values from the error page.
>> >
>> > Any clues??
>>
>> I can think of at least two ways to do this:
>>
>> 1) use session scope for your form bean; wheter the user decides to
>> return and re-edit his data, or submit it, the data is still in the
>> session-scoped form
> 
> Thats what I did. Is that a good thing to do??

Yes, provided you are OK with putting data into the session. Some people 
  prefer to avoid that at all costs :-)

> 2) if you want to avoid using the session, you could serialize the
>> submitted data as hidden fields in the error page; then the user submits
>> that page, their inputs will be re-submitted from the hidden fields, and
>> thus available to the next action
> 
> Thought of this..but wouldnt that make  code maintanence a problem. I 
> mean i
> add a field to the old form..n il have to add it here..n so on... what do
> you think??

Well, if I was going to take that approach, I'd probably look for a way 
to automate it so I didn't have to maintain the mapping by hand.

L.


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


Re: Retain Form Bean

Posted by Puneet Lakhina <pu...@gmail.com>.
On 10/28/06, Laurie Harper <la...@holoweb.net> wrote:
>
> Puneet Lakhina wrote:
> > hi,
> > I have the following scenario. I have a form that takes certain input.
> This
> > in effect goes through certain validations. Now what I want to do is in
> > case
> > of validation errors a seprarte page is displayed that lists all the
> > errors,
> > and asks the user to continue submitting the data ignoring the errors,
> > or to
> > go back to the form and change the data.
> > My question is how do i submit the data from my error page (which is a
> > different page), in case the user chooses to continue to submit ignoring
> > the
> > errors.
> >
> > So the flow is like this
> >
> > form submit-> if errors - >error page - >if continue ->submit data and
> > store
> > in Database.
> >
> > This continue functionality is what im unable to achieve because I dont
> > know
> > how to resubmit the same form values from the error page.
> >
> > Any clues??
>
> I can think of at least two ways to do this:
>
> 1) use session scope for your form bean; wheter the user decides to
> return and re-edit his data, or submit it, the data is still in the
> session-scoped form


Thats what I did. Is that a good thing to do??

2) if you want to avoid using the session, you could serialize the
> submitted data as hidden fields in the error page; then the user submits
> that page, their inputs will be re-submitted from the hidden fields, and
> thus available to the next action


Thought of this..but wouldnt that make  code maintanence a problem. I mean i
add a field to the old form..n il have to add it here..n so on... what do
you think??


There are probably other approaches too, but that should at least give
> you a starting point.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
thanks

-- 
Puneet

Re: Retain Form Bean

Posted by Laurie Harper <la...@holoweb.net>.
Puneet Lakhina wrote:
> hi,
> I have the following scenario. I have a form that takes certain input. This
> in effect goes through certain validations. Now what I want to do is in 
> case
> of validation errors a seprarte page is displayed that lists all the 
> errors,
> and asks the user to continue submitting the data ignoring the errors, 
> or to
> go back to the form and change the data.
> My question is how do i submit the data from my error page (which is a
> different page), in case the user chooses to continue to submit ignoring 
> the
> errors.
> 
> So the flow is like this
> 
> form submit-> if errors - >error page - >if continue ->submit data and 
> store
> in Database.
> 
> This continue functionality is what im unable to achieve because I dont 
> know
> how to resubmit the same form values from the error page.
> 
> Any clues??

I can think of at least two ways to do this:

1) use session scope for your form bean; wheter the user decides to 
return and re-edit his data, or submit it, the data is still in the 
session-scoped form

2) if you want to avoid using the session, you could serialize the 
submitted data as hidden fields in the error page; then the user submits 
that page, their inputs will be re-submitted from the hidden fields, and 
thus available to the next action

There are probably other approaches too, but that should at least give 
you a starting point.

L.


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