Title: RE: ActionForm validation

You can set the scope of the bean in your action mappings in the struts-config.xml.  See below:

    <action    path="/action/saveOptions"
               type="com.foo.SaveOptionsAction"
              input="/action/options.jsp"
               name="form"
              scope="session"
           validate="true">
      <forward name="somePage"       path="/foo/somepage.jsp"/>
    </action>

-----Original Message-----
From: Sue Deng [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 27, 2001 12:01 PM
To: [EMAIL PROTECTED]
Subject: ActionForm validation


Hi,

I am trying to use my ActionForm object to perform simple validations.
If validation fails, I think the controller servlet will forward control
bake to the input form with whatever the user has entered.  For example,
8 characters is required for a field, but user just entered 4
characters.  Those 4 characters should be in the input text field in the
input form, but it gave me a blank field.

I use struts taglib.  It looks like this in a input form:

.......
<html:form name="ipForm" action="ip.do"
type="net.covalent.........IPForm">
<html:text property="ip"
........

where "ip" is a variable field in IPForm class

I was wondering if the scope of ActionForm bean is "request" or
"session".  In struts user guide, section 3.3.1, it reads "It (HTML
<form> element) also associates all of the fields within the form with a
session scoped FormBean that is stored uner the key ..."  So, where can
I set the scope the the ActionForm bean?

Thanks,

-Sue

Reply via email to