File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Please help with Radio Button in Struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Please help with Radio Button in Struts 2" Watch "Please help with Radio Button in Struts 2" New topic
Author

Please help with Radio Button in Struts 2

JackKumar Kumari
Greenhorn

Joined: Mar 23, 2009
Posts: 14
Hi,

I am new to Java. I would really appreciate if someone could help me with the radio button.

I need to have a radio button, and if the user selects one of them some text should come up. Do not know the syntax for if statement. I have the code below:

<s:radio name="first" list="{'Yes','No'}" value ="%{'Yes'}"/>
<s:if test ="%{#first == 'Yes'}">
<div><testing></div>
</s:if>

Please help. Thanks in Advance.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you're trying to dynamically change the page then you need to use JavaScript--tags are evaluated on the *server* side.
JackKumar Kumari
Greenhorn

Joined: Mar 23, 2009
Posts: 14
I am sorry to bother you with the question again.

Just for may understanding you mean that I will have to use Javascript if I want to have the ability for the user to change the radio buttons on the web and display data accordingly(depending on the selection by the user I dispaly the set of questions).

Thanks in advance

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

If you need to change page contents without a form submit/page refresh then you'll need to use JavaScript and/or Ajax.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please help with Radio Button in Struts 2