This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes how to by dfault get the radio button be selected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to by dfault get the radio button be selected" Watch "how to by dfault get the radio button be selected" New topic
Author

how to by dfault get the radio button be selected

vijaya Yarlagadda
Greenhorn

Joined: Jun 23, 2008
Posts: 4
Hi all,
I am using struts framework. And I want a radio button to be selected by default. This is my code...
In jsp:
<html:radio property="check" value="Promote" >Promote</html:radio>
<html:radio property="check" value="Shift" />Shift</td></tr>

In FormBean Class:
private String check = null;

public String getCheck() {
return check;
}

public void setCheck(String check) {
this.check = check;
}

I want promote to be selected by default. I also tried by assigning the value promote in the bean class.. but stil i couldnt get it.. I wil be very grateful if anyone can help me out...


vijaya Yarlagadda
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

"vijayaY vijayaY", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rodrigo Tomita
Ranch Hand

Joined: Apr 28, 2008
Posts: 70
You need to set the value in the class you declared to be your form. This thread has a discussion about the same subject.

Hope it helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to by dfault get the radio button be selected
 
Similar Threads
How to disable html:checkbox based on html:radio selection
using html:radio
how to make html:radio default selected
problem with "html:radio"
preselect a radio button