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