You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Van Wart <sc...@indosoft.com> on 2006/08/16 18:01:28 UTC
LookupDispatchAction using wrong resource bundle!
I have multiple resource bundles in addition to the default one in
struts-config.xml:
<message-resources parameter="MessageResources" null="false" />
<!-- I put id, parameter and key, because I'm not convinced I know
what each one does :( -->
<message-resources id="constraints" parameter="constraints"
key="constraints"
factory="ca.indosoft.common.resource.ConstraintResourcesFactory"
null="true" />
In my Action:
protected void create( ... ) { ... }
// and so on...
protected Map getKeyMethodMap()
{
final Map<String, String> map = new TreeMap<String, String>();
map.put( "form.label.create", "create" );
map.put( "form.label.update", "update" );
map.put( "form.label.delete", "delete" );
map.put( "form.label.clear", "clear" );
map.put( "form.label.cancel", "cancel" );
map.put( "form.label.new", "makeNew" );
return map;
}
But when I debug through it, in LookupDispatchAction.initLookupMap(
HttpServletRequest, Locale ), it's using the
ConstraintResourcesFactory! The only place I actually say
'bundle="constraints"' is in my validation.xml, which doesn't get hit at
all (my app fails because LookupDispatchAction is looking in the
ConstraintResources class, and not MessageResources.properties):
<form name="myForm">
<field property="title" depends="required,maxlength">
<msg name="required" key="error.title.required" />
<msg name="maxlength" key="error.title.overflow" />
<arg name="maxlength" bundle="constraints" key="title.length" />
</field>
</form>
Is this a bug, or an issue with my implementation?
Thanks,
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: LookupDispatchAction using wrong resource bundle!
Posted by Scott Van Wart <sc...@indosoft.com>.
LookupDispatchAction checks ALL the resource bundles (and doesn't even
stop when it finds the key). Does anyone see any reason why it can't
use the same mechanism as everything else, or has this been fixed in a
later version?
- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org