You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Vernon Wu <ve...@gatewaytech.com> on 2002/09/15 10:23:59 UTC

Is a way to let a tag of JSTL works with a custom tag?

I have a custom tag which retrieves an attribute of a bean, and the attribute needs to be controved by the 18n 
message from its presentation.

How I can get the value of <mytag:beanAttribute attribute="province"/>, but not the literal string in
<fmt:message key="<mytag:beanAttribute attribute="province"/>"/> ?

Thanks,

Vernon



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Is a way to let a tag of JSTL works with a custom tag?

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Vernon Wu wrote:
 > I have a custom tag which retrieves an attribute of a bean, and the
 > attribute needs to be controved by the 18n message from its
 > presentation.
 >
 > How I can get the value of <mytag:beanAttribute
 > attribute="province"/>, but not the literal string in <fmt:message
 > key="<mytag:beanAttribute attribute="province"/>"/> ?

Assuming your <mytag:beanAttribute> action writes a value that you
want to use as a resource bundle key, you can use this syntax:

   <fmt:message>
     <mytag:beanAttribute attribute="province"/>
   </fmt:message>

Most JSTL actions allow you specify the main input either as an
attribute or as the action's body like this.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
JavaServer Pages	http://TheJSPBook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Is a way to let a tag of JSTL works with a custom tag?

Posted by Shawn Bayern <ba...@essentially.net>.
On Sun, 15 Sep 2002, Vernon Wu wrote:

> I have a custom tag which retrieves an attribute of a bean, and the
> attribute needs to be controved by the 18n message from its
> presentation.
> 
> How I can get the value of <mytag:beanAttribute attribute="province"/>,
> but not the literal string in
> <fmt:message key="<mytag:beanAttribute attribute="province"/>"/> ?

It's not clear whether your tag refers to data that's accessible using
JSTL's expression language.  If it does, you'd need to provide more
information about what the bean is before we'd be able to help.  But in
the worst case, you could do this:

 <c:set var="key">
  <mytag:beanAttribute attribute="province"/>
 </c:set>
 <fmt:message key="${key}" />

-- 
Shawn Bayern
"JSTL in Action"   http://www.jstlbook.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>