Take a look at the struts-example. For subscriptions and registration
tasks, there are 2 parts to the flow.
1. Setup
2. Save
In a general sense "Setup" is usually an "edit" or a "new" when using the
application. The only difference being that edit uses some values from
persistence to allow the user to edit them. "new" just presents the user
with a blank form so that they can fill it out from scratch.
In both cases, the "setup" is handled by one action and uses a request
parameter to determine if this is a a "new" subscription or "editing" an
existing one. That parameter is called (coincidentally) "action".
Here's the struts-config entry to handle that:
<!-- Edit mail subscription -->
<action path="/editSubscription"
type="org.apache.struts.webapp.example.EditSubscriptionAction"
attribute="subscriptionForm"
scope="request"
validate="false">
<forward name="failure" path="/mainMenu.jsp"/>
<forward name="success" path="/subscription.jsp"/>
</action>
...notice that this action uses attribute="subscriptionForm" instead of
name="subscriptionForm" as is done when saving the subsciption...
<!-- Save mail subscription -->
<action path="/saveSubscription"
type="org.apache.struts.webapp.example.SaveSubscriptionAction"
name="subscriptionForm"
scope="request"
input="subscription">
<forward name="subscription" path="/subscription.jsp"/>
<forward name="success"
path="/editRegistration.do?action=Edit"/>
</action>
What this essentially saying is..."let me setup the form on the way into the
page, and let me tell struts which form I used when it gets submitted.
I hope this clears it up for you.
--
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
----- Original Message -----
From: "Sloan Bowman" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, June 11, 2003 9:54 AM
Subject: Re: <html:text Error?...
> Do you mean specify the form bean in the struts-config.xml or the
> <html:form tag? Thanks for the help
>
> --Sloan
>
> At 11:25 AM 6/11/2003, you wrote:
> >You need to specify that your particular action uses a form-bean (for
> >example "UserFormBean"). You may be wanting to display a blank form to
the
> >user, but as the jsp is rendering that form, it needs to check the fields
of
> >UserFormBean to display it's content (which could be null or empty in
your
> >case). You would specify the action to submit to in the html:form tag.
> >Struts will then use the form-bean that you specified (which happens to
be
> >the same..."UserFormBean").
> >
> >Does this help?
> >
> >
> >--
> >James Mitchell
> >Software Developer/Struts Evangelist
> >http://www.struts-atlanta.org
> >
> >
> >----- Original Message -----
> >From: "Sloan Bowman" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Wednesday, June 11, 2003 11:25 AM
> >Subject: <html:text Error?...
> >
> >
> > > When I am creating a form text field with <html:text
property="username"/>
> > > I get the following error message. I wasn't aware I was supossed to be
> > > using a bean yet. I thought you put the bean in the submitted Action.
> > >
> > >
> > > Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
> > >
> > > I am developing on Tomcat 4.1.18 and Struts 1.1.rc1. Thanks for your
help.
> > >
> > >
> > > --Sloan
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]