class userRegistrationForm extends ActionForm{
private String firstName;
. . . . . .
public ActionErrors validade(ActionMapping mapping, HttpServletRequest request){
ActionErrors errors = new ActionErrors();
if(firstName == null || firstName.trim().equals("") )
errors.add("firstName", new ActionError("userRegistration.firstName.problem");
. . . . . .
}
}
No meu arquivo jsp defino assim :
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<head>
<title>User Registration</title>
</head>
<body>
<h1>User Registration</h1>
<html:errors/>
<table>
<html:form action="/userRegistration">
<tr>
<td>
<bean:message key="userRegistration.firstName"/>
</td>
<td>
<html:text property="firstName"/>
</td>
</tr>
. . . . . .
Esta tudo dando certo, mas quando deixo o campo firstName sem nenhum valor, ao invés de ver a mensagem de erro na página tenho a seguinte mensagem de erro padrão do tomcat:
No input attribute for mapping path /userRegistration
O arquivo resorce.property já esta com o valor do erro para ser exibido.