Well I got it resolved. The <rtexprvalue> was set to false in the TLD file. Once set to true the following worked:

JSP:
<%
String productTypeI18nKey = "product.type.list." + productType;
%>
<s:text name="<%=productTypeI18nKey%>"/>

Graham
----- Original Message ----- From: <gd...@jslss.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Thursday, June 25, 2009 6:02 PM
Subject: Re: Dynamic value supplied s:text name in struts 2


Correction on this question.

With Struts1 the following would work:


JSP:
<%
String productType = [get the productType from the form]
String productTypeI18nKey = "product.type.list." + productType;
%>
<bean:message key="<%=productTypeI18nKey%>"/>


With the Struts2, how would I do the same.  I've tried:


JSP:
<%
String productTypeI18nKey = "product.type.list." + productType;
%>
<s:text name="<%=productTypeI18nKey%>"/>


When I execute the above JSP, I get the following error
"According to TLD or attribute directive in tag file, attribute name does
not accept any expressions"

How do I supply a dynamic value as a key for the s:text tag?


Thanks in advance,
Graham





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to