• Post Reply Bookmark Topic Watch Topic
  • New Topic

multiple resource bundles and validation.xml on struts 1.1  RSS feed

Eduardo Plata
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to display a error message using xml struts plugin validator that it's on another resource bundle, but the key doesn't get the value. I have this:

On strtus-config.xml
<form-bean name="myForm" type="com.i2b.sged.struts.MyActionForm" />
<action input="/jsp/lajsp.jsp" name="myForm" path="/myAction" scope="request" type="com.i2b.sged.struts.MyAction" validate="true">
<forward name="success" path="/jsp/lasalida.jsp" />
<message-resources parameter="resources.sged"/>
<message-resources key="prueba" parameter="resources.prueba"/>
On my ActionForm
public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {

ActionErrors messages = super.validate(actionMapping,httpServletRequest);
MessageResources bundle = MessageResources.getMessageResources("resources.prueba");
String mensaje = bundle.getMessage("prueba.campo2"); // -> this works fine
if (messages == null)
messages = new ActionErrors();
if ("another validation ....")
messages.add("prueba.campo2",new ActionMessage("errors.required",mensaje));
return messages;
and at last, on my validation.xm
<!-- An example form -->
<form name="myForm">
<arg position="0" key="prueba.test" bundle="prueba"/>

now, when the submit fails on validation the resource bundle "prueba" is not found and the mesagge displayed is only: " is required"

Thanks in advance
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!