struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Newfield <d...@newfield.org>
Subject Re: preselect value for radio tag
Date Fri, 10 Jul 2009 16:37:38 GMT
Bhaarat Sharma wrote:
> I have a very simple radio tag like following
> <s:radio label="correctOption" name="correctAnswer" id="correctOption"
> list=" #{'1':'1','2':'2','3':'3','4':'4'}"
> value="questionVo.correctAnswer"/>
> 
> questionVo.correctAnswer returns 2. So I want the second radio button to be
> preselected but it is not happening. I even tried:
> 
> <s:radio label="correctOption" name="correctAnswer" id="correctOption"
> list=" #{'1':'1','2':'2','3':'3','4':'4'}" value="%{1}"/>
> 
> but that does not work either.
> 
> what am I doing wrong?

http://struts.apache.org/2.1.6/docs/why-wont-the-if-tag-evaluate-a-one-char-string.html
Also, "%{1}" evaluates to a number, whereas "%{'1'}" evaluates to a char 
and '%{"1"}' evaluates to a string.

-Dale

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


Mime
View raw message