struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Van Wart <sc...@indosoft.com>
Subject LookupDispatchAction using wrong resource bundle!
Date Wed, 16 Aug 2006 16:01:28 GMT
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


Mime
View raw message