struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (David M. Karr)
Subject Re: dynamic arg0 in bean:message?
Date Sun, 28 Dec 2003 20:22:40 GMT
>>>>> "Frank" == Frank Maritato <> writes:

    Frank> Hi,
    Frank> What I want to do is something like this:

    Frank> <bean:message key="error.minCharacters"
    Frank>   arg0="<bean:write name="globals" property="minChars" />" />

    Frank> or

    Frank> <bean:message key="error.minCharacters"
    Frank>   arg0="<%=minChars%>" />

    Frank> Where arg0 is the result of a bean property, but I can't seem to get it to
    Frank> work. If I hard-code the value

    Frank> <bean:message key="error.minCharacters" arg0="20" />

    Frank> It works, but it kinda defeats the purpose.

    Frank> What am I doing wrong, or is there a better way to accomplish this?

Well, the best way is probably to use the Struts-EL tag library, which will
allow you to do this:

 <bean:message key="error.minCharacters" arg0="${globals.minChars}" />

Your first attempt failed because you can't nest custom tags in custom tag

Your second attempt failed (probably) because your scriptlet variable
"minChars" was not declared, or set to the value of your bean property.

David M. Karr          ; Java/J2EE/XML/Unix/C++   ; SCJP; SCWCD; SCBCD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message