thanks for your reply, perhaps there's something I've haven't understand:

I'd like to display  in my select dropdown data that come from a 
database... where should I get this data from the DB this should be done 
before the call of the getXXX method of the ActionForm when.

Should I use an action where I get data from the DB and forward it to 
the action associated with the jsp page containing the form?? is it the 
way to do it?


Vincent

Galbreath, Mark wrote:
> It's magic.
> 
> 
> Seriously, your getters and setters in your ActionForm bean correspond to
> the HTML input fields in your JSP.  So if you have a select dropdown in the
> JSP called "state," in some HTML form for collecting personal information
> you could have
> 
>   private state = "";
> 
>   public void setState( String state) {
>     this.state = state;
>   }
> 
>   public String getState() {
>     return state;
>   }
> 
> in your Action form.  In order to make Struts aware of this bean, you must
> declare in your struts-config.xml file and have an action path mapped from
> your JSP to an Action class that will manipulate the bean values that are
> set by Struts:
> 
> <form-bean  name="PersonalInfoForm"
>             type="com.whatever.PersonInfoForm" />
> 
> <action path="/personalInfo"
>         type="com.whatever.GetPersonalInfoAction" 
>         name="PersonalInfoForm"
>         scope="session"
>         validate="true"
>         parameter="isNew">
>   <forward name="success" path="/personalInfo.jsp" />
>   <forward name="error" path="/errors.jsp" />
> </action>
> 
> So this associates your bean with your JSP and your ActionClass.  When your
> user goes to http://yoursite/personalInfo.do (depending on the mapping in
> your web.xml), personalInfo.jsp will be invoked and the rendered HTML
> displayed.  After the user fills out the form and submits (for example, the
> form action is /reviewPersonalInfo which will display everything the user
> just entered), the following action path is invoked:
> 
> <action path="/reviewPersonalInfo"
>         type="com.whatever.SavePersonalInfoAction"
>         name="PersonalInfoForm"
>         input="/PersonalInfo.jsp"
>         scope="session"
>         validate="true"
>         parameter="isError">
>   <forward name="success" path="/reviewPersonalInfo.jsp" />
>   <forward name="error" path="/personalInfo.jsp" />
> </action>
> 
> and reviewPersonalInfo.jsp will appear to display the information contained
> in your bean through the use of Struts tags. At this point you can also
> access the bean's state in your Action class through the form object to save
> it to a database or whatever.
> 
> Okay?
> 
> Mark
> 
> (That should have earned me a few [OT/FRIDAY] msgs, eh?)
> 
> 
> -----Original Message-----
> From: Vincent Berruchon [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 24, 2002 11:19 AM
> 
>   Hi, I'm still newie and really confused on how to get HTML form filled 
> with struts...
> I want to fill a select input in a form in one of my JSP.
> So I've write an ActionForm Bean with the get and set methods for each 
> properties corresponding to an input on the form.
> But I don't know where these "set" methods are (or should) be called to 
> fill actionForm properties before the calls to the get methods?
> 
> Can someone help us?
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to