• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

application.resources don't show me the messages

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need a <html:errors /> or <html:messages> tag to display the error message. See the section entitled "Displaying Error Messages" in this link.
 
Marcelo Heitor
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, tanks, tanks my friend
it was this same that it was lacking
 
Marcelo Heitor
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ops...
...thanks, thanks...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic