Here are two ways to do what you want (without creating your own tag), as suggested by Craig and Martin:
http://nagoya.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED] he.org&msgId=425573 http://nagoya.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED] he.org&msgId=426577 (Martin's solution does not work with Struts 1.0.2) You can see all the messages in the thread at: http://nagoya.apache.org/eyebrowse/SearchList?listId=&listName=struts-user@j akarta.apache.org&searchText=bean_message+is+problematic chris > -----Original Message----- > From: Patrick Refondini [mailto:[EMAIL PROTECTED]] > Sent: Sunday, August 11, 2002 6:55 AM > To: Struts Mailing List > Subject: Accessing MessageResources From Runtime Expression > > > > I try to refer to image paths stored in MessageResources from > a Runtime > Expression in order to dynamically define Javascripts. > > I look for a mix of bean:message and bean:define tags that > would let me do: > > <bean:define-message > id="closeActionActiveBtnMessage" > key="close.action.active_button" > toScope="page" /> > > <bean:define-message > id="closeActionBtnMessage" > key="close.action.button" > toScope="page" /> > > In order to accomplish: > > <nested:image srcKey="close.action.button" > property ="setCloseAction" > styleClass ="unSelMnuBtn" > onmouseover='<%="this.src=\'" + > closeActionActiveBtnMessage + "\'"%>' > onmouseout ='<%="this.src=\'" + > closeActionBtnMessage + > "\'"%>' /> > > I might not have understood that an already existing tags > solves this ! > Or should I create a custom "<bean:define-message>" tag ? > > > I'll be pleased of any direction you can point me to, thanks > Patrick > > > > Here after a code sample of a working test I have closely based :) on > the the <bean:message> source code > (org.apache.struts.taglib.bean.MessageTag.doStartTag() > Author: Craig R. > McClanahan, Version: $Revision: 1.4 $ $Date: 2001/02/20 01:48:45 $) : > > <% > // Get the message > String closeActionActiveBtnMessage = RequestUtils.message( > pageContext, Action.MESSAGES_KEY, Action.LOCALE_KEY, > "close.action.active_button"); > // Check if it was found > if (closeActionActiveBtnMessage == null) { > JspException e = new JspException > ("Error: close.action.active_button message > resource not found."); > RequestUtils.saveException(pageContext, e); > throw e; > } > > // Build the Javascript given the message (image path). > String closeActionActiveBtnScript = "this.src=\'" + > closeActionActiveBtnMessage + "\'"; > > // Return the script as a bean to the pageContext at > the given > scope > pageContext.setAttribute("closeActionActiveBtnScript", > closeActionActiveBtnScript, PageContext.PAGE_SCOPE); > > (... idem for "closeActionBtnScript" ...) > %> > > <nested:image > srcKey="com.extentis.webapp.adhoc.close.action.button" > property="setCloseAction" > styleClass="unSelMnuBtn" > onmouseover='<%=closeActionActiveBtnScript%>' > onmouseout='<%=closeActionBtnScript%>' /> > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>