Is it possible to use <bean:write /> or <c:out /> to look up a key that is
not known until runtime (ie, stored in the request)?

I have a results screen that will display a message that varies depending on
the query performed.  I would like this message to be retrieved from the
<message-resources ../> bundle in the struts-config.xml.  

For example, my Action will have logic:

if (isFriend) {
  request.setAttribute("friendText", "key.friend");
} else if (isEnemy) {
  request.setAttribute("friendText", "key.enemy");
} else {
  request.setAttribute("friendText", "key.unknown");
}

I would like my JSP to get the value of the Request Attribute "friendText",
then lookup that key in the MessageResources file:

key.friend = <P>Hello friend. I like you.
key.enemy = <P>Hello enemy. I hate you.
key.unknown = <P>Hello.

I checked the API for bean:write and c:out and looking to see if struts-el
provided this functionality. I didn't see any indication that it does,
though I have not used struts-el in the past.

Any ideas?

Thanks!
Greg

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

Reply via email to