You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian Topping <to...@digidemic.com> on 2002/11/08 21:17:35 UTC

RE: Problem with multiple html(jsp) pages sharing one form (actionform)

Hi all,

I'm running into this problem too.  My DynaActionForm is getting cleared
between calls to my action.

I'm using DispatchAction as my base class, so I have actions like
'FooAction?method=setupForm', 'FooAction?method=page1',
'FooAction?method=page2', etc.  

Is resetting the form a "feature" in this case as well, even though the class
is the same?  Or do I literally have to use the same method in order to avoid
a reset?  The latter seems to kill the very nice code layout I get from using
DispatchActions for different form pages, although I could go in and
re-implement the code such that the same method becomes a dispatcher, yada
yada.

I'm trying out this stuff as I write, but I guess I am sending this anyway
because I believe this is a misfeature/bug if it actually works this way.
IMHO, vectors in a DispatchAction should be a special semantic case WRT forms
getting reset.

Thanks for your consideration of this,

-b

> -----Original Message-----
> From: James Mitchell [mailto:jmitchtx@telocity.com]
> Sent: Monday, October 28, 2002 1:21 AM
> To: Struts Users Mailing List
> Subject: RE: Problem with multiple html(jsp) pages sharing one form
> (actionform)
> 
> 
> Ok, sorry, I didn't see that, although I tend to use the same 
> action (and
> jsp) for my wizards anyway.
> 
> So you are saying that you are not sure where the data is lost?
> 
> One way I might test this:
> 
> (Assuming you have)
> Step 1:     jsp1 -> fowardaction1 -> jsp2
> Step 2:     jsp2 -> fowardaction2 -> jsp3
> Step 3:     jsp3 -> ejbaction -> jsp
> 
> 
> Do this.
> Step 1:     jsp1 -> fowardaction1 -> jsp2
> Step 2:     jsp2 -> fowardaction2 -> jsp3
> now hit your browser's back button one time
> now hit your browser's refresh button
> 
> you will be prompted to re-submit the form data, click ok (or 
> yes, depending
> on your browser)
> 
> At this point you are sitting at the end of Step 1 (or the 
> beginning of Step
> 2, same thing).
> Now if the data had been stored in the session correctly in 
> Step 1, then
> your form should be sitting there already filled out for you.
> 
> Try that.
> 
> James Mitchell
> Software Engineer/Struts Evangelist
> http://www.open-tools.org
> 
> "Only two things are infinite, the universe and human 
> stupidity, and I'm not
> sure about the former."
> - Albert Einstein (1879-1955)
> 
> 
> > -----Original Message-----
> > From: Derek Lin [mailto:dereklin@hotmail.com]
> > Sent: Monday, October 28, 2002 1:11 AM
> > To: Struts Users Mailing List
> > Subject: Re: Problem with multiple html(jsp) pages sharing one form
> > (actionform)
> >
> >
> > James,
> >
> > Please be patient with me.  I just want to point out this 
> sentence in that
> > paragraph:
> > "Likewise, the various pages of the same form should all be
> > submitted to the
> > same Action Class."
> > Now, doesn't that say the "same Action Class"?
> >
> > If you still think what I have should work, then maybe something
> > is wrong in
> > my EJBRegistrationAction class (the last Action Class in the
> > chain.)  Let me
> > just mention that I was using one single form with request scope for
> > this--and that was working.
> >
> > Thanks for helping.
> >
> > -- Derek
> >
> > ----- Original Message -----
> > From: "James Mitchell" <jm...@telocity.com>
> > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > Sent: Sunday, October 27, 2002 9:46 PM
> > Subject: RE: Problem with multiple html(jsp) pages sharing one form
> > (actionform)
> >
> >
> > > No, it says single ActionForm bean, which you are already doing.
> > >                    ^^^^^^^^^^
> > >
> > > I'm afraid you'll have to do a bit more debugging.  
> Unless you want to
> > step
> > > through your code in debug, I would try creating your own 
> ForwardAction
> > with
> > > a few print statements to narrow down exactly where they might
> > be getting
> > > cleared.
> > >
> > >
> > >
> > > James Mitchell
> > > Software Engineer/Struts Evangelist
> > > http://www.open-tools.org
> > >
> > > "Only two things are infinite, the universe and human 
> stupidity, and I'm
> > not
> > > sure about the former."
> > > - Albert Einstein (1879-1955)
> > >
> > >
> > > > -----Original Message-----
> > > > From: Derek Lin [mailto:dereklin@hotmail.com]
> > > > Sent: Monday, October 28, 2002 12:36 AM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Problem with multiple html(jsp) pages 
> sharing one form
> > > > (actionform)
> > > >
> > > >
> > > > I am using the 1.1beta version(beta1 I guess, are there any
> > > > changes between
> > > > beta1 and 2 on this?)
> > > >
> > > > Now, I have been doing a little research myself.  And I 
> have found a
> > > > paragraph on
> > > > http://jakarta.apache.org/struts/userGuide/building_model.html:
> > > >
> > > > "Think, for example, of the wizard style user interface that
> > is commonly
> > > > used when installing new applications. Struts encourages you
> > to define a
> > > > single ActionForm bean that contains properties for all 
> of the fields,
> > no
> > > > matter which page the field is actually displayed on. Likewise,
> > > > the various
> > > > pages of the same form should all be submitted to the 
> same Action
> > > > Class. If
> > > > you follow these suggestions, the page designers can 
> rearrange the
> > fields
> > > > among the various pages, often without requiring changes to the
> > processing
> > > > logic. "
> > > >
> > > > Looks like it is telling people do use the same action 
> as well.  Am I
> > > > reading this correctly?  If I use the same action for 
> these different
> > html
> > > > pages, I then have to find out how many form values I 
> have for the
> > > > redirection.  For example, if I don't have userinfo 
> yet, redirect to
> > > > userinfo page.  That is not very elegant, can anyone agree?
> > > >
> > > > -- Derek
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Problem with multiple html(jsp) pages sharing one form (actionform)

Posted by Derek Lin <de...@hotmail.com>.
I was reading Struts in Action chapter 12:
"If you are using the one-big-form wizard approach, the Struts Validator
includes a page property on the field element and provides a corresponding
page property on the ValidatorForm."

But the book doesn't give any example.

Dese it mean I should do something like this?:
<form-property name="firstName" type="java.lang.String" page="1"/>

And then pass a url param in my action?

If anyone knows, please give some pointers.  I am going to try this out
soon.

Thanks,

Derek

----- Original Message -----
From: "Brian Topping" <to...@digidemic.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, November 08, 2002 12:17 PM
Subject: RE: Problem with multiple html(jsp) pages sharing one form
(actionform)


Hi all,

I'm running into this problem too.  My DynaActionForm is getting cleared
between calls to my action.

I'm using DispatchAction as my base class, so I have actions like
'FooAction?method=setupForm', 'FooAction?method=page1',
'FooAction?method=page2', etc.

Is resetting the form a "feature" in this case as well, even though the
class
is the same?  Or do I literally have to use the same method in order to
avoid
a reset?  The latter seems to kill the very nice code layout I get from
using
DispatchActions for different form pages, although I could go in and
re-implement the code such that the same method becomes a dispatcher, yada
yada.

I'm trying out this stuff as I write, but I guess I am sending this anyway
because I believe this is a misfeature/bug if it actually works this way.
IMHO, vectors in a DispatchAction should be a special semantic case WRT
forms
getting reset.

Thanks for your consideration of this,

-b

> -----Original Message-----
> From: James Mitchell [mailto:jmitchtx@telocity.com]
> Sent: Monday, October 28, 2002 1:21 AM
> To: Struts Users Mailing List
> Subject: RE: Problem with multiple html(jsp) pages sharing one form
> (actionform)
>
>
> Ok, sorry, I didn't see that, although I tend to use the same
> action (and
> jsp) for my wizards anyway.
>
> So you are saying that you are not sure where the data is lost?
>
> One way I might test this:
>
> (Assuming you have)
> Step 1:     jsp1 -> fowardaction1 -> jsp2
> Step 2:     jsp2 -> fowardaction2 -> jsp3
> Step 3:     jsp3 -> ejbaction -> jsp
>
>
> Do this.
> Step 1:     jsp1 -> fowardaction1 -> jsp2
> Step 2:     jsp2 -> fowardaction2 -> jsp3
> now hit your browser's back button one time
> now hit your browser's refresh button
>
> you will be prompted to re-submit the form data, click ok (or
> yes, depending
> on your browser)
>
> At this point you are sitting at the end of Step 1 (or the
> beginning of Step
> 2, same thing).
> Now if the data had been stored in the session correctly in
> Step 1, then
> your form should be sitting there already filled out for you.
>
> Try that.
>
> James Mitchell
> Software Engineer/Struts Evangelist
> http://www.open-tools.org
>
> "Only two things are infinite, the universe and human
> stupidity, and I'm not
> sure about the former."
> - Albert Einstein (1879-1955)
>
>
> > -----Original Message-----
> > From: Derek Lin [mailto:dereklin@hotmail.com]
> > Sent: Monday, October 28, 2002 1:11 AM
> > To: Struts Users Mailing List
> > Subject: Re: Problem with multiple html(jsp) pages sharing one form
> > (actionform)
> >
> >
> > James,
> >
> > Please be patient with me.  I just want to point out this
> sentence in that
> > paragraph:
> > "Likewise, the various pages of the same form should all be
> > submitted to the
> > same Action Class."
> > Now, doesn't that say the "same Action Class"?
> >
> > If you still think what I have should work, then maybe something
> > is wrong in
> > my EJBRegistrationAction class (the last Action Class in the
> > chain.)  Let me
> > just mention that I was using one single form with request scope for
> > this--and that was working.
> >
> > Thanks for helping.
> >
> > -- Derek
> >
> > ----- Original Message -----
> > From: "James Mitchell" <jm...@telocity.com>
> > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > Sent: Sunday, October 27, 2002 9:46 PM
> > Subject: RE: Problem with multiple html(jsp) pages sharing one form
> > (actionform)
> >
> >
> > > No, it says single ActionForm bean, which you are already doing.
> > >                    ^^^^^^^^^^
> > >
> > > I'm afraid you'll have to do a bit more debugging.
> Unless you want to
> > step
> > > through your code in debug, I would try creating your own
> ForwardAction
> > with
> > > a few print statements to narrow down exactly where they might
> > be getting
> > > cleared.
> > >
> > >
> > >
> > > James Mitchell
> > > Software Engineer/Struts Evangelist
> > > http://www.open-tools.org
> > >
> > > "Only two things are infinite, the universe and human
> stupidity, and I'm
> > not
> > > sure about the former."
> > > - Albert Einstein (1879-1955)
> > >
> > >
> > > > -----Original Message-----
> > > > From: Derek Lin [mailto:dereklin@hotmail.com]
> > > > Sent: Monday, October 28, 2002 12:36 AM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Problem with multiple html(jsp) pages
> sharing one form
> > > > (actionform)
> > > >
> > > >
> > > > I am using the 1.1beta version(beta1 I guess, are there any
> > > > changes between
> > > > beta1 and 2 on this?)
> > > >
> > > > Now, I have been doing a little research myself.  And I
> have found a
> > > > paragraph on
> > > > http://jakarta.apache.org/struts/userGuide/building_model.html:
> > > >
> > > > "Think, for example, of the wizard style user interface that
> > is commonly
> > > > used when installing new applications. Struts encourages you
> > to define a
> > > > single ActionForm bean that contains properties for all
> of the fields,
> > no
> > > > matter which page the field is actually displayed on. Likewise,
> > > > the various
> > > > pages of the same form should all be submitted to the
> same Action
> > > > Class. If
> > > > you follow these suggestions, the page designers can
> rearrange the
> > fields
> > > > among the various pages, often without requiring changes to the
> > processing
> > > > logic. "
> > > >
> > > > Looks like it is telling people do use the same action
> as well.  Am I
> > > > reading this correctly?  If I use the same action for
> these different
> > html
> > > > pages, I then have to find out how many form values I
> have for the
> > > > redirection.  For example, if I don't have userinfo
> yet, redirect to
> > > > userinfo page.  That is not very elegant, can anyone agree?
> > > >
> > > > -- Derek
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>