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

2002-11-09 Thread Derek Lin
Didn't get this to work the way I want.  The problem is that I don't know
how to set the page property of the DynaValidatorForm without using my own
Action.

The best thing I can think of so far is to use my own ActionMapping to set
the page.  And in my Action class, I set the page property of my
DynaValidatorForm from my ActionMapping property.

This sort of work, but I don't like it:

1) in my validation.xml:
form name=RegistrationForm
  field property=firstName depends=required page=1arg0
key=firstName//field
   field property=companyName depends=required page=0arg0
key=company//field
...
2) in my struts-config.xml:
action
  path=/registration-user
  input=/registration/company.jsp
  name=RegistrationForm
  parameter=/registration/user.jsp
  scope=session

type=com.futurecargo.web.framework.struts.actions.EJBMultiRegistrationActio
n
  validate=true
  set-property property=page value=1 /
  forward name=success path=/registration/user.jsp /
/action

3) I have a custom ActionMapping which sets the page property

4) In my Action class:
 public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response) throws Exception {
MyActionMapping fcMapping = (MyActionMapping)mapping;
DynaValidatorForm myForm = (DynaValidatorForm)form;
myForm.setPage(fcMapping.getPage());
...

Problems I've noticed:

1) Too much work
2) Javascript validation doesn't work on second page (works only on first
page)

I don't know struts inside and out.  I wish those of you who do can provide
an example application (just an multi-page form)  for this.

Anyway, just wanted to share what I have found out.

-- Derek
- Original Message -
From: Derek Lin [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, November 08, 2002 6:48 PM
Subject: Re: Problem with multiple html(jsp) pages sharing one form
(actionform)


 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 [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 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

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

2002-11-08 Thread Brian Topping
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 [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  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

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

2002-11-08 Thread Derek Lin
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 [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
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 [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  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

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

2002-10-30 Thread Derek Lin
In case anyone is interested.  I solve the problem by extending
org.apache.struts.validator.DynaValidatorForm and overriding the method
public void reset(org.apache.struts.action.ActionMapping mapping,
  javax.servlet.http.HttpServletRequest request){};

-- Derek

- Original Message -
From: James Mitchell [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, October 28, 2002 10:52 PM
Subject: RE: Problem with multiple html(jsp) pages sharing one form
(actionform)


 No, not in the scenario I described earlier.



 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: Tuesday, October 29, 2002 1:22 AM
  To: Struts Users Mailing List
  Subject: Re: Problem with multiple html(jsp) pages sharing one form
  (actionform)
 
 
  James,
 
  Are you using the plugin validator to validate your form fields?
 
  I am using it.  (see my form entry in my validation.xml at the
  end).  Now If
  I only include a subset of form in one page, the validator will throw
  exceptions in the backgroud.  Are you aware of this?  Any workaround
other
  than modifying the validator's source?
 
  Thanks,
 
  Derek
 
  form name=RegistrationForm
field property=firstName
depends=futurecargorequiredarg0
  key=firstName//field
field property=lastName depends=futurecargorequiredarg0
  key=lastName//field
   field property=companyName
depends=futurecargorequiredarg0
  key=company//field
   field property=companyStreet
  depends=futurecargorequiredarg0
  key=street//field
   field property=companyCity
depends=futurecargorequiredarg0
  key=city//field
   field property=companyState
  depends=futurecargorequiredarg0
  key=state//field
   field property=companyZip
depends=futurecargorequired,mask
  arg0 key=zip/
 
  varvar-namemask/var-namevar-value${zip}/var-value/var
/field
   field property=companyCountry
  depends=futurecargorequiredarg0 key=country//field
   field property=companyPhone
  depends=futurecargorequired,mask
  arg0 key=phone/
 
  varvar-namemask/var-namevar-value${phone}/var-value/var
/field
   field property=companyEmail
  depends=futurecargorequired,emailarg0 key=email//field
field property=companyUsername
  depends=futurecargorequired,minlength
  arg0 key=username/
  arg1 name=minlength key=${var:minlength}
  resource=false/
 
  varvar-nameminlength/var-namevar-value3/var-value/var
/field
   field property=companyPassword
  depends=futurecargorequired,minlength,mask
  arg0 key=password/
arg1 name=minlength key=${var:minlength} resource=false/
 
  varvar-namemask/var-namevar-value^[0-9a-zA-Z][0-9a-zA-Z][0
  -9a-zA-Z][
  0-9a-zA-Z]*$/var-value/var
varvar-nameminlength/var-namevar-value5/var-value/var
   /field
field property=companyPassword2
  depends=futurecargorequired,twofields
  arg0 key=password2/
  arg1 key=password/
 
  varvar-namesecondProperty/var-namevar-valuecompanyPassword
  /var-valu
  e/var
/field
  /form
 
  - Original Message -
  From: James Mitchell [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Monday, October 28, 2002 1:36 PM
  Subject: RE: Problem with multiple html(jsp) pages sharing one form
  (actionform)
 
 
   Hi Derek,
  
   Sorry for not getting back sooner.
  
  
if you are using the same action and jsp for your wizards, how
are they qualified to be wizards?
  
   Whenever I need a wizard-like flow in my application, I use a single
  action
   and a single jsp to go from Step 1 to Step n.
  
   I can do this by passing around a token called step, which is
  a field on
   my form used only for the purpose of this wizard.
  
  
   Here's a bit of psuedo code...
  
   wizard.jsp
   --
   taglib declarations
  
   html:form blah blah
   !-- Stuff you want on every page --
  
  
   !-- Step 1 --
logic:equal name=wizardForm
 property=step
 value=1
  
 Field 1:html:text property=field1/br
 Field 2:html:text property=field2/br
 Field 3:html:text property=field3/br
 Field 4:html:text property=field4/br
 Field 5:html:text property=field5/br
  
/logic:equal
  
   !-- Step 2 --
logic:equal name=wizardForm
 property=step
 value=2
  
 Field 6:html:text property=field6/br
 Field 7:html:text property=field7/br
 Field 8:html:text property=field8/br
 Field 9:html:text property=field9/br

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

2002-10-28 Thread James Mitchell
Hi Derek,

Sorry for not getting back sooner.


 if you are using the same action and jsp for your wizards, how
 are they qualified to be wizards?

Whenever I need a wizard-like flow in my application, I use a single action
and a single jsp to go from Step 1 to Step n.

I can do this by passing around a token called step, which is a field on
my form used only for the purpose of this wizard.


Here's a bit of psuedo code...

wizard.jsp
--
taglib declarations

html:form blah blah
!-- Stuff you want on every page --


!-- Step 1 --
 logic:equal name=wizardForm
  property=step
  value=1

  Field 1:html:text property=field1/br
  Field 2:html:text property=field2/br
  Field 3:html:text property=field3/br
  Field 4:html:text property=field4/br
  Field 5:html:text property=field5/br

 /logic:equal

!-- Step 2 --
 logic:equal name=wizardForm
  property=step
  value=2

  Field 6:html:text property=field6/br
  Field 7:html:text property=field7/br
  Field 8:html:text property=field8/br
  Field 9:html:text property=field9/br
  Field 10:html:text property=field10/br

 /logic:equal

!-- Step 3 --
 logic:equal name=wizardForm
  property=step
  value=3

  Field 11:html:text property=field11/br
  Field 12:html:text property=field12/br
  Field 13:html:text property=field13/br
  Field 14:html:text property=field14/br
  Field 15:html:text property=field15/br

 /logic:equal

/html:form


So I handle the form submit and validation within my Action class (This give
me the most control).

By doing it this way, if I need to move field 6 thru 8 to Step 1, I can drag
it up
there within my text editor. (as opposed to cutting it from one jsp and
pasting into another)

Not to mention repeating the page headers footer and any other page data
(style, javascript, etc)


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 2:01 AM
 To: Struts Users Mailing List
 Subject: Re: Problem with multiple html(jsp) pages sharing one form
 (actionform)


 James,
 First of all, if you are using the same action and jsp for your
 wizards, how
 are they qualified to be wizards?  Perhaps I am not getting what you mean.
 But a wizard would mean many different jsp's to me.  But anyway,
 that is not
 very important at this point.

 I tried what you have suggested.  All the data is gone.

 On top of that, I have did some debugging.

 This is what I get from the my RegistrationForm after I hit
 submit in step1:
 (As you can see the properties are set nicely)
 DynaActionForm[dynaClass=RegistrationForm,userPhoneType=,companyPa
 ssword2=,c
 ompanyEmailType=primary,companyPassword=,companyUsername=,creditca
 rdNumber=,
 companyPhone=1234567890,userEmailType=,companyName=u,companyZip=94
 112,credit
 cardType=,userPhone=,creditcardExpDate=,userRole=admin,companyFax=
 u,companyS
 treet=u,[EMAIL PROTECTED],firstName=,companyCountry=US,company
 State=u,us
 erFax=,companyStreet2=u,userEmail=,companyAddressType=primary,comp
 anyProvinc
 e=,companyPhoneType=primary,companyCity=u,lastName=]

 Now, when I hit submit on step2, here is what I get: (The previous values
 are gone.  Only new values are there.  The reset method had to be
 called or
 a new instance of RegistrationForm was generated.)
 DynaActionForm[dynaClass=RegistrationForm,userPhoneType=,companyPa
 ssword2=12
 3456,companyEmailType=primary,companyPassword=123456,companyUserna
 me=uyy,cre
 ditcardNumber=,companyPhone=,userEmailType=,companyName=,companyZi
 p=,creditc
 ardType=,userPhone=u,creditcardExpDate=,userRole=admin,companyFax=
 ,companySt
 reet=,companyEmail=,firstName=u,companyCountry=,companyState=,user
 Fax=u,comp
 anyStreet2=,userEmail=u,companyAddressType=primary,companyProvince
 =,companyP
 honeType=primary,companyCity=,lastName=u]

 One more thing is that, not sure if this is relevant, I am also using the
 struts validator to validate for form.  And while I fix the JavaScript to
 only validate the existing formfileds, the struts validator (java) is
 throwing exceptions on my console (since the form values don't
 exist -- I
 only use a portion of the form here -- you get the picture, right?)  These
 exceptions do cause the application to stop.  My app goes on with no
 apparent problems.  (At some point, I want to modify the
 validator to detect
 existing formfields only.  Or is anyone working on that?)

 To sum this up.  I think either the reset method is called or a
 new instance
 of my form is created.

 Do you have a example of a wizard working?--one that expands to
 two or more
 jsp's.  If so, can you just copy and paste the code here

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

2002-10-28 Thread Derek Lin
James,

Are you using the plugin validator to validate your form fields?

I am using it.  (see my form entry in my validation.xml at the end).  Now If
I only include a subset of form in one page, the validator will throw
exceptions in the backgroud.  Are you aware of this?  Any workaround other
than modifying the validator's source?

Thanks,

Derek

form name=RegistrationForm
  field property=firstName depends=futurecargorequiredarg0
key=firstName//field
  field property=lastName depends=futurecargorequiredarg0
key=lastName//field
 field property=companyName depends=futurecargorequiredarg0
key=company//field
 field property=companyStreet depends=futurecargorequiredarg0
key=street//field
 field property=companyCity depends=futurecargorequiredarg0
key=city//field
 field property=companyState depends=futurecargorequiredarg0
key=state//field
 field property=companyZip depends=futurecargorequired,mask
arg0 key=zip/

varvar-namemask/var-namevar-value${zip}/var-value/var
  /field
 field property=companyCountry
depends=futurecargorequiredarg0 key=country//field
 field property=companyPhone depends=futurecargorequired,mask
arg0 key=phone/

varvar-namemask/var-namevar-value${phone}/var-value/var
  /field
 field property=companyEmail
depends=futurecargorequired,emailarg0 key=email//field
  field property=companyUsername
depends=futurecargorequired,minlength
arg0 key=username/
arg1 name=minlength key=${var:minlength} resource=false/

varvar-nameminlength/var-namevar-value3/var-value/var
  /field
 field property=companyPassword
depends=futurecargorequired,minlength,mask
arg0 key=password/
  arg1 name=minlength key=${var:minlength} resource=false/

varvar-namemask/var-namevar-value^[0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z][
0-9a-zA-Z]*$/var-value/var
  varvar-nameminlength/var-namevar-value5/var-value/var
 /field
  field property=companyPassword2
depends=futurecargorequired,twofields
arg0 key=password2/
arg1 key=password/

varvar-namesecondProperty/var-namevar-valuecompanyPassword/var-valu
e/var
  /field
/form

- Original Message -
From: James Mitchell [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, October 28, 2002 1:36 PM
Subject: RE: Problem with multiple html(jsp) pages sharing one form
(actionform)


 Hi Derek,

 Sorry for not getting back sooner.


  if you are using the same action and jsp for your wizards, how
  are they qualified to be wizards?

 Whenever I need a wizard-like flow in my application, I use a single
action
 and a single jsp to go from Step 1 to Step n.

 I can do this by passing around a token called step, which is a field on
 my form used only for the purpose of this wizard.


 Here's a bit of psuedo code...

 wizard.jsp
 --
 taglib declarations

 html:form blah blah
 !-- Stuff you want on every page --


 !-- Step 1 --
  logic:equal name=wizardForm
   property=step
   value=1

   Field 1:html:text property=field1/br
   Field 2:html:text property=field2/br
   Field 3:html:text property=field3/br
   Field 4:html:text property=field4/br
   Field 5:html:text property=field5/br

  /logic:equal

 !-- Step 2 --
  logic:equal name=wizardForm
   property=step
   value=2

   Field 6:html:text property=field6/br
   Field 7:html:text property=field7/br
   Field 8:html:text property=field8/br
   Field 9:html:text property=field9/br
   Field 10:html:text property=field10/br

  /logic:equal

 !-- Step 3 --
  logic:equal name=wizardForm
   property=step
   value=3

   Field 11:html:text property=field11/br
   Field 12:html:text property=field12/br
   Field 13:html:text property=field13/br
   Field 14:html:text property=field14/br
   Field 15:html:text property=field15/br

  /logic:equal

 /html:form


 So I handle the form submit and validation within my Action class (This
give
 me the most control).

 By doing it this way, if I need to move field 6 thru 8 to Step 1, I can
drag
 it up
 there within my text editor. (as opposed to cutting it from one jsp and
 pasting into another)

 Not to mention repeating the page headers footer and any other page data
 (style, javascript, etc)


 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 2:01 AM
  To: Struts Users Mailing List
  Subject: Re: Problem with multiple html(jsp) pages sharing one form

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

2002-10-28 Thread James Mitchell
No, not in the scenario I described earlier.



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: Tuesday, October 29, 2002 1:22 AM
 To: Struts Users Mailing List
 Subject: Re: Problem with multiple html(jsp) pages sharing one form
 (actionform)


 James,

 Are you using the plugin validator to validate your form fields?

 I am using it.  (see my form entry in my validation.xml at the
 end).  Now If
 I only include a subset of form in one page, the validator will throw
 exceptions in the backgroud.  Are you aware of this?  Any workaround other
 than modifying the validator's source?

 Thanks,

 Derek

 form name=RegistrationForm
   field property=firstName depends=futurecargorequiredarg0
 key=firstName//field
   field property=lastName depends=futurecargorequiredarg0
 key=lastName//field
  field property=companyName depends=futurecargorequiredarg0
 key=company//field
  field property=companyStreet
 depends=futurecargorequiredarg0
 key=street//field
  field property=companyCity depends=futurecargorequiredarg0
 key=city//field
  field property=companyState
 depends=futurecargorequiredarg0
 key=state//field
  field property=companyZip depends=futurecargorequired,mask
 arg0 key=zip/

 varvar-namemask/var-namevar-value${zip}/var-value/var
   /field
  field property=companyCountry
 depends=futurecargorequiredarg0 key=country//field
  field property=companyPhone
 depends=futurecargorequired,mask
 arg0 key=phone/

 varvar-namemask/var-namevar-value${phone}/var-value/var
   /field
  field property=companyEmail
 depends=futurecargorequired,emailarg0 key=email//field
   field property=companyUsername
 depends=futurecargorequired,minlength
 arg0 key=username/
 arg1 name=minlength key=${var:minlength}
 resource=false/

 varvar-nameminlength/var-namevar-value3/var-value/var
   /field
  field property=companyPassword
 depends=futurecargorequired,minlength,mask
 arg0 key=password/
   arg1 name=minlength key=${var:minlength} resource=false/

 varvar-namemask/var-namevar-value^[0-9a-zA-Z][0-9a-zA-Z][0
 -9a-zA-Z][
 0-9a-zA-Z]*$/var-value/var
   varvar-nameminlength/var-namevar-value5/var-value/var
  /field
   field property=companyPassword2
 depends=futurecargorequired,twofields
 arg0 key=password2/
 arg1 key=password/

 varvar-namesecondProperty/var-namevar-valuecompanyPassword
 /var-valu
 e/var
   /field
 /form

 - Original Message -
 From: James Mitchell [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Monday, October 28, 2002 1:36 PM
 Subject: RE: Problem with multiple html(jsp) pages sharing one form
 (actionform)


  Hi Derek,
 
  Sorry for not getting back sooner.
 
 
   if you are using the same action and jsp for your wizards, how
   are they qualified to be wizards?
 
  Whenever I need a wizard-like flow in my application, I use a single
 action
  and a single jsp to go from Step 1 to Step n.
 
  I can do this by passing around a token called step, which is
 a field on
  my form used only for the purpose of this wizard.
 
 
  Here's a bit of psuedo code...
 
  wizard.jsp
  --
  taglib declarations
 
  html:form blah blah
  !-- Stuff you want on every page --
 
 
  !-- Step 1 --
   logic:equal name=wizardForm
property=step
value=1
 
Field 1:html:text property=field1/br
Field 2:html:text property=field2/br
Field 3:html:text property=field3/br
Field 4:html:text property=field4/br
Field 5:html:text property=field5/br
 
   /logic:equal
 
  !-- Step 2 --
   logic:equal name=wizardForm
property=step
value=2
 
Field 6:html:text property=field6/br
Field 7:html:text property=field7/br
Field 8:html:text property=field8/br
Field 9:html:text property=field9/br
Field 10:html:text property=field10/br
 
   /logic:equal
 
  !-- Step 3 --
   logic:equal name=wizardForm
property=step
value=3
 
Field 11:html:text property=field11/br
Field 12:html:text property=field12/br
Field 13:html:text property=field13/br
Field 14:html:text property=field14/br
Field 15:html:text property=field15/br
 
   /logic:equal
 
  /html:form
 
 
  So I handle the form submit and validation within my Action class (This
 give
  me the most control).
 
  By doing it this way, if I need to move field 6 thru 8 to Step 1, I can
 drag
  it up

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

2002-10-27 Thread Derek Lin
I find this paragraph from the programming struts book:
You don't have to declare an ActionForm for every HTML form in your application.  The 
same ActionForm can be associated with one or more action mappings. This means that 
they can be shared across multiple HTML forms. For example, if you had a wizard 
interface, where a set of data was entered and posted across multiple pages, a single 
ActionForm can be used to capture all of this data, a few fields at a time.

So I tried to implement similar pages.  
Here is the form:
form-bean
name=RegistrationForm
  dynamic=true
type=org.apache.struts.validator.DynaValidatorForm
  form-property name=userRole type=java.lang.String/
  form-property name=firstName type=java.lang.String/
  form-property name=lastName type=java.lang.String/
  form-property name=companyName type=java.lang.String/
  form-property name=companyAddressType type=java.lang.String/
  form-property name=companyStreet type=java.lang.String/
  form-property name=companyStreet2 type=java.lang.String/
  form-property name=companyCity type=java.lang.String/
  form-property name=companyState type=java.lang.String/
  form-property name=companyProvince type=java.lang.String/
  form-property name=companyZip type=java.lang.String/  
  form-property name=companyCountry type=java.lang.String/
  form-property name=companyPhone type=java.lang.String/
  form-property name=companyPhoneType type=java.lang.String/
  form-property name=companyFax type=java.lang.String/
  form-property name=companyEmail type=java.lang.String/
  form-property name=companyEmailType type=java.lang.String/
 form-property name=companyPassword type=java.lang.String/
 form-property name=companyPassword2 type=java.lang.String/ 
  form-property name=companyUsername type=java.lang.String/
  form-property name=creditcardType type=java.lang.String/
  form-property name=creditcardNumber type=java.lang.String/
  form-property name=creditcardExpDate type=java.lang.String/
  form-property name=userPhone type=java.lang.String/
  form-property name=userPhoneType type=java.lang.String/
  form-property name=userFax type=java.lang.String/
  form-property name=userEmail type=java.lang.String/
  form-property name=userEmailType type=java.lang.String/
/form-bean

Here are my actions mapping:
action
  path=/registration-user
  input=/registration/company.jsp
  name=RegistrationForm
  parameter=/registration/user.jsp
  scope=session
  type=org.apache.struts.actions.ForwardAction
  validate=true/
action
  path=/registration-creditcard
  input=/registration/user.jsp
  name=RegistrationForm
  parameter=/registration/creditcard.jsp
  scope=session
  type=org.apache.struts.actions.ForwardAction
  validate=true/
action
path=/registration-company-all
type=com.futurecargo.framework.actions.EJBRegistrationAction
name=RegistrationForm
scope=session
validate=true
input=/registration/creditcard.jsp
 forward name=success path=/registration/success.jsp /
 forward name=failure path=/index.jsp /
/action

The problem is that the form values are not being carried over.  (I am thinking if I 
need to use hidden values on my subsequent html pages).  Has anyone successfully 
implemented something like this?  Please help.

Thanks,

Derek





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

2002-10-27 Thread David Graham
Your values might be getting reset by your reset method.

David



From: Derek Lin [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Problem with multiple html(jsp) pages sharing one form 
(actionform)
Date: Sun, 27 Oct 2002 18:57:17 -0800

I find this paragraph from the programming struts book:
You don't have to declare an ActionForm for every HTML form in your 
application.  The same ActionForm can be associated with one or more action 
mappings. This means that they can be shared across multiple HTML forms. 
For example, if you had a wizard interface, where a set of data was entered 
and posted across multiple pages, a single ActionForm can be used to 
capture all of this data, a few fields at a time.

So I tried to implement similar pages.
Here is the form:
form-bean
name=RegistrationForm
  dynamic=true
type=org.apache.struts.validator.DynaValidatorForm
  form-property name=userRole type=java.lang.String/
  form-property name=firstName type=java.lang.String/
  form-property name=lastName type=java.lang.String/
  form-property name=companyName type=java.lang.String/
  form-property name=companyAddressType 
type=java.lang.String/
  form-property name=companyStreet type=java.lang.String/
  form-property name=companyStreet2 type=java.lang.String/
  form-property name=companyCity type=java.lang.String/
  form-property name=companyState type=java.lang.String/
  form-property name=companyProvince type=java.lang.String/
  form-property name=companyZip type=java.lang.String/
  form-property name=companyCountry type=java.lang.String/
  form-property name=companyPhone type=java.lang.String/
  form-property name=companyPhoneType type=java.lang.String/
  form-property name=companyFax type=java.lang.String/
  form-property name=companyEmail type=java.lang.String/
  form-property name=companyEmailType type=java.lang.String/
 form-property name=companyPassword type=java.lang.String/
 form-property name=companyPassword2 type=java.lang.String/
  form-property name=companyUsername type=java.lang.String/
  form-property name=creditcardType type=java.lang.String/
  form-property name=creditcardNumber type=java.lang.String/
  form-property name=creditcardExpDate 
type=java.lang.String/
  form-property name=userPhone type=java.lang.String/
  form-property name=userPhoneType type=java.lang.String/
  form-property name=userFax type=java.lang.String/
  form-property name=userEmail type=java.lang.String/
  form-property name=userEmailType type=java.lang.String/
/form-bean

Here are my actions mapping:
action
  path=/registration-user
  input=/registration/company.jsp
  name=RegistrationForm
  parameter=/registration/user.jsp
  scope=session
  type=org.apache.struts.actions.ForwardAction
  validate=true/
action
  path=/registration-creditcard
  input=/registration/user.jsp
  name=RegistrationForm
  parameter=/registration/creditcard.jsp
  scope=session
  type=org.apache.struts.actions.ForwardAction
  validate=true/
action
path=/registration-company-all
type=com.futurecargo.framework.actions.EJBRegistrationAction
name=RegistrationForm
scope=session
validate=true
input=/registration/creditcard.jsp
 forward name=success path=/registration/success.jsp /
 forward name=failure path=/index.jsp /
/action

The problem is that the form values are not being carried over.  (I am 
thinking if I need to use hidden values on my subsequent html pages).  Has 
anyone successfully implemented something like this?  Please help.

Thanks,

Derek




_
Choose an Internet access plan right for you -- try MSN! 
http://resourcecenter.msn.com/access/plans/default.asp


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



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

2002-10-27 Thread Derek Lin
I am using the org.apache.struts.validator.DynaValidatorForm.  You mean the
reset method is called every time an action is invoked?  If that is true.  I
would have to extend the DynaValidatorForm to write my own actionform,
correct?

-- Derek


- Original Message -
From: David Graham [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, October 27, 2002 8:10 PM
Subject: Re: Problem with multiple html(jsp) pages sharing one form
(actionform)


 Your values might be getting reset by your reset method.

 David


 From: Derek Lin [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Problem with multiple html(jsp) pages sharing one form
 (actionform)
 Date: Sun, 27 Oct 2002 18:57:17 -0800
 
 I find this paragraph from the programming struts book:
 You don't have to declare an ActionForm for every HTML form in your
 application.  The same ActionForm can be associated with one or more
action
 mappings. This means that they can be shared across multiple HTML forms.
 For example, if you had a wizard interface, where a set of data was
entered
 and posted across multiple pages, a single ActionForm can be used to
 capture all of this data, a few fields at a time.
 
 So I tried to implement similar pages.
 Here is the form:
  form-bean
  name=RegistrationForm
dynamic=true
  type=org.apache.struts.validator.DynaValidatorForm
form-property name=userRole type=java.lang.String/
form-property name=firstName type=java.lang.String/
form-property name=lastName type=java.lang.String/
form-property name=companyName type=java.lang.String/
form-property name=companyAddressType
 type=java.lang.String/
form-property name=companyStreet type=java.lang.String/
form-property name=companyStreet2 type=java.lang.String/
form-property name=companyCity type=java.lang.String/
form-property name=companyState type=java.lang.String/
form-property name=companyProvince
type=java.lang.String/
form-property name=companyZip type=java.lang.String/
form-property name=companyCountry type=java.lang.String/
form-property name=companyPhone type=java.lang.String/
form-property name=companyPhoneType
type=java.lang.String/
form-property name=companyFax type=java.lang.String/
form-property name=companyEmail type=java.lang.String/
form-property name=companyEmailType
type=java.lang.String/
   form-property name=companyPassword type=java.lang.String/
   form-property name=companyPassword2 type=java.lang.String/
form-property name=companyUsername
type=java.lang.String/
form-property name=creditcardType type=java.lang.String/
form-property name=creditcardNumber
type=java.lang.String/
form-property name=creditcardExpDate
 type=java.lang.String/
form-property name=userPhone type=java.lang.String/
form-property name=userPhoneType type=java.lang.String/
form-property name=userFax type=java.lang.String/
form-property name=userEmail type=java.lang.String/
form-property name=userEmailType type=java.lang.String/
  /form-bean
 
 Here are my actions mapping:
  action
path=/registration-user
input=/registration/company.jsp
name=RegistrationForm
parameter=/registration/user.jsp
scope=session
type=org.apache.struts.actions.ForwardAction
validate=true/
  action
path=/registration-creditcard
input=/registration/user.jsp
name=RegistrationForm
parameter=/registration/creditcard.jsp
scope=session
type=org.apache.struts.actions.ForwardAction
validate=true/
  action
  path=/registration-company-all
 
type=com.futurecargo.framework.actions.EJBRegistrationAction
  name=RegistrationForm
  scope=session
  validate=true
  input=/registration/creditcard.jsp
   forward name=success path=/registration/success.jsp /
   forward name=failure path=/index.jsp /
  /action
 
 The problem is that the form values are not being carried over.  (I am
 thinking if I need to use hidden values on my subsequent html pages).
Has
 anyone successfully implemented something like this?  Please help.
 
 Thanks,
 
 Derek
 
 


 _
 Choose an Internet access plan right for you -- try MSN!
 http://resourcecenter.msn.com/access/plans/default.asp


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


--
To unsubscribe, e-mail:   mailto:struts-user-unsubscribe

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

2002-10-27 Thread David Graham
That sounds like a solution but I haven't used dyna beans.  Also, I always 
put my beans in the request so I never worry about the reset method.  All 
you have to do to find out when it's called is to put a System.out.println() 
in reset and hit the page a few times.

David






From: Derek Lin [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Problem with multiple html(jsp) pages sharing one form 
(actionform)
Date: Sun, 27 Oct 2002 21:15:46 -0800

I am using the org.apache.struts.validator.DynaValidatorForm.  You mean the
reset method is called every time an action is invoked?  If that is true.  
I
would have to extend the DynaValidatorForm to write my own actionform,
correct?

-- Derek


- Original Message -
From: David Graham [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, October 27, 2002 8:10 PM
Subject: Re: Problem with multiple html(jsp) pages sharing one form
(actionform)


 Your values might be getting reset by your reset method.

 David


 From: Derek Lin [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Problem with multiple html(jsp) pages sharing one form
 (actionform)
 Date: Sun, 27 Oct 2002 18:57:17 -0800
 
 I find this paragraph from the programming struts book:
 You don't have to declare an ActionForm for every HTML form in your
 application.  The same ActionForm can be associated with one or more
action
 mappings. This means that they can be shared across multiple HTML 
forms.
 For example, if you had a wizard interface, where a set of data was
entered
 and posted across multiple pages, a single ActionForm can be used to
 capture all of this data, a few fields at a time.
 
 So I tried to implement similar pages.
 Here is the form:
  form-bean
  name=RegistrationForm
dynamic=true
  type=org.apache.struts.validator.DynaValidatorForm
form-property name=userRole type=java.lang.String/
form-property name=firstName type=java.lang.String/
form-property name=lastName type=java.lang.String/
form-property name=companyName type=java.lang.String/
form-property name=companyAddressType
 type=java.lang.String/
form-property name=companyStreet 
type=java.lang.String/
form-property name=companyStreet2 
type=java.lang.String/
form-property name=companyCity type=java.lang.String/
form-property name=companyState type=java.lang.String/
form-property name=companyProvince
type=java.lang.String/
form-property name=companyZip type=java.lang.String/
form-property name=companyCountry 
type=java.lang.String/
form-property name=companyPhone type=java.lang.String/
form-property name=companyPhoneType
type=java.lang.String/
form-property name=companyFax type=java.lang.String/
form-property name=companyEmail type=java.lang.String/
form-property name=companyEmailType
type=java.lang.String/
   form-property name=companyPassword 
type=java.lang.String/
   form-property name=companyPassword2 type=java.lang.String/
form-property name=companyUsername
type=java.lang.String/
form-property name=creditcardType 
type=java.lang.String/
form-property name=creditcardNumber
type=java.lang.String/
form-property name=creditcardExpDate
 type=java.lang.String/
form-property name=userPhone type=java.lang.String/
form-property name=userPhoneType 
type=java.lang.String/
form-property name=userFax type=java.lang.String/
form-property name=userEmail type=java.lang.String/
form-property name=userEmailType 
type=java.lang.String/
  /form-bean
 
 Here are my actions mapping:
  action
path=/registration-user
input=/registration/company.jsp
name=RegistrationForm
parameter=/registration/user.jsp
scope=session
type=org.apache.struts.actions.ForwardAction
validate=true/
  action
path=/registration-creditcard
input=/registration/user.jsp
name=RegistrationForm
parameter=/registration/creditcard.jsp
scope=session
type=org.apache.struts.actions.ForwardAction
validate=true/
  action
  path=/registration-company-all
 
type=com.futurecargo.framework.actions.EJBRegistrationAction
  name=RegistrationForm
  scope=session
  validate=true
  input=/registration/creditcard.jsp
   forward name=success path=/registration/success.jsp /
   forward name=failure path=/index.jsp /
  /action
 
 The problem is that the form values are not being carried over.  (I am
 thinking if I need to use hidden

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

2002-10-27 Thread James Mitchell
You would only need hidden fields if you were using request scope for this
wizard.

From looking at what you've provided, it appears that it should work just
fine.

What release or build of struts are you using?

BTW, you can remove 'dynamic=true', as it is no longer required.



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:16 AM
 To: Struts Users Mailing List
 Subject: Re: Problem with multiple html(jsp) pages sharing one form
 (actionform)


 I am using the org.apache.struts.validator.DynaValidatorForm.
 You mean the
 reset method is called every time an action is invoked?  If that
 is true.  I
 would have to extend the DynaValidatorForm to write my own actionform,
 correct?

 -- Derek


 - Original Message -
 From: David Graham [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, October 27, 2002 8:10 PM
 Subject: Re: Problem with multiple html(jsp) pages sharing one form
 (actionform)


  Your values might be getting reset by your reset method.
 
  David
 
 
  From: Derek Lin [EMAIL PROTECTED]
  Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: Problem with multiple html(jsp) pages sharing one form
  (actionform)
  Date: Sun, 27 Oct 2002 18:57:17 -0800
  
  I find this paragraph from the programming struts book:
  You don't have to declare an ActionForm for every HTML form in your
  application.  The same ActionForm can be associated with one or more
 action
  mappings. This means that they can be shared across multiple
 HTML forms.
  For example, if you had a wizard interface, where a set of data was
 entered
  and posted across multiple pages, a single ActionForm can be used to
  capture all of this data, a few fields at a time.
  
  So I tried to implement similar pages.
  Here is the form:
   form-bean
   name=RegistrationForm
 dynamic=true
   type=org.apache.struts.validator.DynaValidatorForm
 form-property name=userRole type=java.lang.String/
 form-property name=firstName type=java.lang.String/
 form-property name=lastName type=java.lang.String/
 form-property name=companyName type=java.lang.String/
 form-property name=companyAddressType
  type=java.lang.String/
 form-property name=companyStreet
 type=java.lang.String/
 form-property name=companyStreet2
 type=java.lang.String/
 form-property name=companyCity type=java.lang.String/
 form-property name=companyState type=java.lang.String/
 form-property name=companyProvince
 type=java.lang.String/
 form-property name=companyZip type=java.lang.String/
 form-property name=companyCountry
 type=java.lang.String/
 form-property name=companyPhone type=java.lang.String/
 form-property name=companyPhoneType
 type=java.lang.String/
 form-property name=companyFax type=java.lang.String/
 form-property name=companyEmail type=java.lang.String/
 form-property name=companyEmailType
 type=java.lang.String/
form-property name=companyPassword
 type=java.lang.String/
form-property name=companyPassword2 type=java.lang.String/
 form-property name=companyUsername
 type=java.lang.String/
 form-property name=creditcardType
 type=java.lang.String/
 form-property name=creditcardNumber
 type=java.lang.String/
 form-property name=creditcardExpDate
  type=java.lang.String/
 form-property name=userPhone type=java.lang.String/
 form-property name=userPhoneType
 type=java.lang.String/
 form-property name=userFax type=java.lang.String/
 form-property name=userEmail type=java.lang.String/
 form-property name=userEmailType
 type=java.lang.String/
   /form-bean
  
  Here are my actions mapping:
   action
 path=/registration-user
 input=/registration/company.jsp
 name=RegistrationForm
 parameter=/registration/user.jsp
 scope=session
 type=org.apache.struts.actions.ForwardAction
 validate=true/
   action
 path=/registration-creditcard
 input=/registration/user.jsp
 name=RegistrationForm
 parameter=/registration/creditcard.jsp
 scope=session
 type=org.apache.struts.actions.ForwardAction
 validate=true/
   action
   path=/registration-company-all
  
 type=com.futurecargo.framework.actions.EJBRegistrationAction
   name=RegistrationForm
   scope=session
   validate

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

2002-10-27 Thread Derek Lin
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

- Original Message -
From: James Mitchell [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Sunday, October 27, 2002 9:26 PM
Subject: RE: Problem with multiple html(jsp) pages sharing one form
(actionform)


 You would only need hidden fields if you were using request scope for this
 wizard.

 From looking at what you've provided, it appears that it should work just
 fine.

 What release or build of struts are you using?

 BTW, you can remove 'dynamic=true', as it is no longer required.



 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:16 AM
  To: Struts Users Mailing List
  Subject: Re: Problem with multiple html(jsp) pages sharing one form
  (actionform)
 
 
  I am using the org.apache.struts.validator.DynaValidatorForm.
  You mean the
  reset method is called every time an action is invoked?  If that
  is true.  I
  would have to extend the DynaValidatorForm to write my own actionform,
  correct?
 
  -- Derek
 
 
  - Original Message -
  From: David Graham [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Sunday, October 27, 2002 8:10 PM
  Subject: Re: Problem with multiple html(jsp) pages sharing one form
  (actionform)
 
 
   Your values might be getting reset by your reset method.
  
   David
  
  
   From: Derek Lin [EMAIL PROTECTED]
   Reply-To: Struts Users Mailing List
[EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Subject: Problem with multiple html(jsp) pages sharing one form
   (actionform)
   Date: Sun, 27 Oct 2002 18:57:17 -0800
   
   I find this paragraph from the programming struts book:
   You don't have to declare an ActionForm for every HTML form in your
   application.  The same ActionForm can be associated with one or more
  action
   mappings. This means that they can be shared across multiple
  HTML forms.
   For example, if you had a wizard interface, where a set of data was
  entered
   and posted across multiple pages, a single ActionForm can be used to
   capture all of this data, a few fields at a time.
   
   So I tried to implement similar pages.
   Here is the form:
form-bean
name=RegistrationForm
  dynamic=true
type=org.apache.struts.validator.DynaValidatorForm
  form-property name=userRole type=java.lang.String/
  form-property name=firstName type=java.lang.String/
  form-property name=lastName type=java.lang.String/
  form-property name=companyName
type=java.lang.String/
  form-property name=companyAddressType
   type=java.lang.String/
  form-property name=companyStreet
  type=java.lang.String/
  form-property name=companyStreet2
  type=java.lang.String/
  form-property name=companyCity
type=java.lang.String/
  form-property name=companyState
type=java.lang.String/
  form-property name=companyProvince
  type=java.lang.String/
  form-property name=companyZip type=java.lang.String/
  form-property name=companyCountry
  type=java.lang.String/
  form-property name=companyPhone
type=java.lang.String/
  form-property name=companyPhoneType
  type=java.lang.String/
  form-property name=companyFax type=java.lang.String/
  form-property name=companyEmail
type=java.lang.String/
  form-property name=companyEmailType
  type=java.lang.String/
 form-property name=companyPassword
  type=java.lang.String/
 form-property name=companyPassword2
type=java.lang.String/
  form-property name

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

2002-10-27 Thread James Mitchell
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:   mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org




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

2002-10-27 Thread Derek Lin
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 [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
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:
mailto:struts-user-unsubscribe;jakarta.apache.org
 For additional commands, e-mail:
mailto:struts-user-help;jakarta.apache.org


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




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

2002-10-27 Thread James Mitchell
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 [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 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:
 mailto:struts-user-unsubscribe;jakarta.apache.org
  For additional commands, e-mail:
 mailto:struts-user-help;jakarta.apache.org
 

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




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