Help folks
I am new in the
struts and...
What is wrong in that code?
package pacotes;
imports...
public class ValidacaoUsuario extends ActionForm{
private
String usuario;
private String senha;
... getters and setters...
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((usuario == null) || (usuario.length() < 1))
errors.add("username", new ActionError("error.username.required"));
return errors;
}
}
/*******************************************/
content of application.properties, he is in the package resources
error.username.required=<LI>Username is required</LI>
/*******************************************/
content of STRUTS-CONFIG.XML
<struts-config>
<form-beans>
<form-bean name="validacaoForm"
type="pacotes.ValidacaoUsuario" />
</form-beans>
<action-mappings>
<action path="/validar"
type="pacotes.UsuarioAction"
name="validacaoForm" scope="request"
validate="true" input="/validacao.jsp">
<forward name="show_menu" path="/menu.jsp" />
</action>
</action-mappings>
<message-resources parameter="resources.application"/>
</struts-config>
/*******************************************************************/
jsp that I need that shows the message in case the user doesn't fill out the field user
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<body>
<form name="form1" action="validar.do" method="post">
Username:<input name="usuario" type="text" id="usuario">
Password:<input name="senha" type="text" id="senha">
<input type="submit" name="Submit" value="Ok">
</form>
</body>
I believe that it is lacking something in that page, but I don't know what is.
Excuse the size of the message
Marcelo Heitor - Bras�lia - Brazil