Compagner-san wrote:

> When setting the args (arg0,arg1,arg2,arg3,arg4)
> you must do this:
> <bean:message key="foo.foo.foo" arg0="foo1" arg1="foo2"/>
>
> [...snip...]
>
> <bean:message key="prompt.advise.wacasco" arg0="<%=
> insurance.getProperty(argstring1).toString() %>" arg1="<%=
> insurance.getProperty(argstring2).toString() %>"/>
> 
> 
> I must define
>       <bean:define id="argstring1" value="totalautotheft"/>
> because i can't do this:
>       <bean:message arg0="<%= insurance.getProperty("totalautotheft").toString()
> %>"

This is exactly the problem that Pellow-san addressed with his sub-tag extentions in 
his message dated Wed, 14 Mar 2001 11:40:40 +1100, titled "Re: BaseFieldTag."

Yes, you will need to create your own BaseAttributeTags, but this is a very powerful 
method to do exactly what you want to do.

Take the above example.  It can be rewritten:

  <bean:message key="prompt.advise.wacasco">
    <bean:arg index="0"><bean:write name="insurance"
              property="totalautotheft"/></bean:arg>
    <bean:arg index="1"><bean:write name="insurance"
              property="whatever"/></bean:arg>
  </bean:message>

The bean tag will have to implement an interface that sets arg(s), the work will have 
to be moved from doBeginTag to doEndTag, and a ArgTag will have to be created in the 
light of Pellow-san's Name tag.  The changes necessary are all pretty simple.  I'm now 
working on creating all of my custom tags in that fassion.

Note:  The bean tag does not currently work like this.  This would be a way to extend 
it to cater to your needs.  We're all developers on the -dev list, right?

Hope this helps.

--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:           http://www.seaple.icc.ne.jp/~westbay
Commentary:     http://www.japanesebaseball.com/

Reply via email to