On Fri, 7 Jun 2002, Andrew Shirk wrote:

> Date: Fri, 7 Jun 2002 15:59:30 -0500
> From: Andrew Shirk <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Dynamic Message Keys
> Resent-Date: Mon, 10 Jun 2002 10:27:53 -0500
> Resent-From: Andrew Shirk <[EMAIL PROTECTED]>
> Resent-To: [EMAIL PROTECTED]
>
> I need to construct a message key dynamically, and am looking for a
> solution that does not use scriptlets. Can anyone suggest an alternative
> to the code below, which works but is ugly.
>
> <nested:define id="type" property="typeName"/>
> <% String key = "type.description." + type; %>
> <div class="widgetLabel"><bean:message key='<%=key%>'/></div>
>

For JSP versions < 1.3, this is about all you can do, since nesting
complete tags inside attribute values is not legal XML syntax.

In JSP 1.3, the expression language syntax from JSTL 1.0 will be supported
throughout the page (not just as arguments to JSTL tag), so you'll be able
to say something like:

  <bean:message key="${key}"/>

> Thanks very much,
>
> Andrew
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to