Hi ,
As Wendy has mentioned-

Otherwise, the place to do this is in your Action, before you forward to the
JSP.

I am interested in populating Form before loading jsp page so that I can 
assign values to HTML comtrols.
HOw to do that?

On 8/4/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> 
> From: "Chris Decker" <[EMAIL PROTECTED]>
> 
> > New to struts so sorry for the simple questions.
> > I have a html: checkbox struts tag and I want to have the checkbox
> > checked initially similar to the checked attribute in a traditional
> > INPUT statement.
> > Can you do this? I've looked everywhere!
> 
> If it's a dynamic form, you can set a default value in struts-config.xml:
> 
> <form-bean name="contactForm"
> type="edu.example.ContactForm">
> <form-property name="onHoldFlag"
> type="java.lang.Boolean" initial="true"/>
> </form-bean>
> 
> Otherwise, the place to do this is in your Action, before you forward to 
> the
> JSP. You only need to set the default the first time the form is 
> displayed.
> Exactly where and how depends on how you've written the app-- do you have 
> a
> 'setup' action that's separate from the one that handles form submission?
> 
> The reset method is not the place to set defaults. In fact, you will need
> to set that checkbox to false/off in the form's reset method. If you 
> don't,
> you will find that there is no way for the user to to un-check it.
> 
> A couple of checkbox links from the FAQ:
> http://struts.apache.org/faqs/newbie.html#checkbox
> http://struts.apache.org/faqs/newbie.html#reset
> 
> --
> Wendy Smoak
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to