Niral Trivedi wrote:
Hi Dave,
Thanks for the reply. I've actually tried with #keepRemoveRadio as well but
got same result. In fact, I got it working by putting "john" or "doe" as
below for <s:param> property:
<s:param name="*Keep*" value="%{'john}"/>
That makes sense, since value="john" will try to evaluate 'john' as an
expression (i.e. will look for it on the value stack) whereas
value="%{'john'}" (or simply value="'john'") evaluates to a literal
string. This is described in the Tag Syntax guide linked at the top of
all the tag documentation pages:
http://struts.apache.org/2.0.11/docs/tag-syntax.html
[Hmm; that said, I just noticed that the 2.0.11 docs for s:param claim
that the value attribute is *not* evaluated, which is inconsistent with
what you're seeing; it could be that the documentation is in need of
updating for that tag.]
Moving ahead, now stuck with a different issue. Actually, I want to create
name of the param dynamically by concatenating two strings. One is already a
struts2 <s:set> property and other is a static value. For example, I want to
do something like this:
Line 1: <s:set name="prop1" value="%{someActionProp}"/>
<s:bean name="java.util.HashMap" id="keepRemoveRadioMap">
* <s:param name="%{prop1}Keep" value="%{prop1}john"/>
<s:param name="Remove" value="%{prop1}doe"/>
* </s:bean>
But I could not get the lines in bold working. Do you have any idea how to
concatenate two strings and assing it to a third variable? I tried
<s:append> but that doesn't work either. Using that I can only iterate and
print the values but cant assign to third variable.
Try <s:param name="%{prop1+'Keep'}" value="%{prop1+'john'}"/> instead
(untested).
L.
Thanks
On Thu, Apr 3, 2008 at 8:40 AM, Dave Newton <[EMAIL PROTECTED]> wrote:
--- Niral Trivedi <[EMAIL PROTECTED]> wrote:
I am using Struts 2.0.11 on RAD7, Webspher 6.1, JDK 1.5.
Hey, me too. My sympathies.
I am trying to create radio buttons using a dynamic Map as below:
<s:bean name="java.util.HashMap" id="keepRemoveRadioMap">
<s:param name="Keep" value="john"/>
<s:param name="Remove" value="doe"/>
</s:bean>
<td width="20%" style="background-color:#fffade; vertical-align:center">
<s:radio name="keepRemove" list="keepRemoveRadioMap" onclick=
"changeKeep1()" theme="simple"/>
</td>
But when I try to load the page, it is giving Freemaker Template
exception
as below(I haven't pasted entire stack trace for readability) :
What happens if you use list="#keepRemoveRadioMap"?
While I've never used the <s:bean...> tag, normally when you create an
object
in the OGNL context like that you need to refer to it with a leading "#"
meaning that it's a named object, not a property of an object on the value
stack.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]