• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

multiple resource bundles and validation.xml on struts 1.1

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
<CODE>
...
<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" />
</action>
...
<message-resources parameter="resources.sged"/>
<message-resources key="prueba" parameter="resources.prueba"/>
</CODE>
On my ActionForm
<CODE>
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;
}
</CODE>
and at last, on my validation.xm
<CODE>
<formset>
<!-- An example form -->
<form name="myForm">
<field
property="campo1"
depends="required">
<arg position="0" key="prueba.test" bundle="prueba"/>
</field>
</form>
</formset>
</CODE>

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
 
Right! We're on it! Let's get to work tiny ad!
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic