wood burning stoves 2.0*
The moose likes Servlets and the fly likes How to retrieve value from Radiobutton..It always returns null inspite of selecting . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to retrieve value from Radiobutton..It always returns null inspite of selecting ." Watch "How to retrieve value from Radiobutton..It always returns null inspite of selecting ." New topic
Author

How to retrieve value from Radiobutton..It always returns null inspite of selecting .

shalu buchasia
Greenhorn

Joined: Jun 04, 2004
Posts: 2

getcolor alwauys returns null? Why? How should I retrieve value from a radio button..

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
In jsp you have to read the value of the button by getParameter()method.then that value passes to the bean to set the color.
thanks.
shalu buchasia
Greenhorn

Joined: Jun 04, 2004
Posts: 2
Where should I call getparameter in my code.....
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
You have the right approach with:
public void setcolor(String tp)
{ color = tp;
}
public String getcolor()
{ return color;
}
BUT you are not observing the Bean naming rule, those methods should be
setColor( String x)
getColor( )
The variable name part of the method name must start with an upper case letter.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retrieve value from Radiobutton..It always returns null inspite of selecting .