Hi all,
I have a form in s jsp that is build with the commponents tags. I use
classicLayout and define the form in the body-area. This are my declarations
in the struts-config:
<form-beans>
<form-bean name="addRequestForm"
type="unizh.ifi.betx.ui.forms.AddRequestForm"/>
</form-beans>
<action path="/addrequest"
type="unizh.ifi.betx.ui.actions.AddRequestAction"
name="addRequestForm"
validate="true">
<forward name="failure" path="forward.addrequest.failure"/>
<forward name="success" path="forward.addrequest.success"/>
</action>
in AddRequestForm I do the following validation:
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((login == null) || (login.length() < 1)) {
errors.add("login", new
ActionError("error.addrequest.login.required"));
}
if ((fullname == null) || (fullname.length() < 1)) {
errors.add("fullname", new
ActionError("error.addrequest.username.required"));
}
if ((email == null) || (email.length() < 1)) {
errors.add("email", new
ActionError("error.addrequest.email.required"));
}
if ((passwort == null) || (passwort.length() < 1)) {
errors.add("passwort", new
ActionError("error.addrequest.password.required"));
}
System.out.println ("Validate: " + errors.size() + " errors.");
return errors;
}
When I leave a text-field emty I get the following output on the consol from
tomcat (integrated with JBoss):
[EmbeddedTomcatSX] Validate: 3 errors.
2001-07-17 01:25:35 - Ctx( /betx ): 500 R( /betx + /addrequest.do + null) No
input attribute for mapping path /addrequest
If I complete the form it is send to addrequest.do and the action.perfrom()
method is called. When there are ActionErrors I want to redisplay the form
which is defined in /betx/accounts.jsp.
What do I have to change?
Thanks a lot
Hajo