On 8/30/06, Tom Bednarz <[EMAIL PROTECTED]> wrote:

The idea is, that I show a form that contains already data and the user
can edit it. When the form is submitted, the validator should check the
user input. Here is my validator configuration:
...
Now it seems, that the validator gets fired BEFORE the form is filled!
In the JSP that displays the form, I get lots of error messages all
fired by the 'required' validator saying, that the field must not be
empty, but all fields are filled corretly!!.

Request -> form bean population -> validation -> Action.execute() ->
forward -> JSP

My advice is to turn off automatic validation, and call it explicitly
when you want it to happen.  That will stop the 'validation errors on
first form display' problem.

Looking at your config, you always pull values from a session scoped
'subscriber' object.

I don't think you need 'value' here:

   <html:text value="${sessionScope.subscriber.familyname}"
     property="familyname" name="familyname" maxlength="64"
     size="32"/>

The 'name' attribute [1] is "The attribute name of the bean whose
properties are consulted when rendering the current value of this
input field."

Does this work?

   <html:text name="subscriber" property="familyname"
                   maxlength="64" size="32"/>

Even after dealing with the 'first display' problem, that still leaves
you validating the form bean (which may be missing data) yet
displaying values from some other bean sitting in session scope.

[1] http://struts.apache.org/1.x/struts-taglib/tlddoc/html/text.html

--
Wendy

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

Reply via email to