Two Laptop Bag*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 12759
    
    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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to retrieve value from Radiobutton..It always returns null inspite of selecting .
 
Similar Threads
a session problem
500 Internal Server Error for example JSP in OC4J + another one
Using Method Invocations
Need to split up servlet
About create a session!