Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Radio Button

 
cathymala louis
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

If I have a two radio buttons.

<html:radio value="Red" property="Color" >Red</html:radio>
<html:radio value="Blue" property="Color" >Blue</html:radio>

How will I get the value which I clicked in Action form. I want to print out the value which I selected in console.

While I try to run the program. I am getting the following error message. Even though my action form has a getter and setter method.

[8/16/07 10:26:31:758 CDT] 56c1b1a9 WebGroup E SRVE0026E: [Servlet Error]-[No getter method available for property Color for bean under name org.apache.struts.taglib.html.BEAN]: javax.servlet.jsp.JspException: No getter method available for property Color for bean under name org.apache.struts.taglib.html.BEAN
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by cathymala louis:
How will I get the value which I clicked in Action form. I want to print out the value which I selected in console.

Just reference the property on the ActionForm bean. Example:

In the above code, the variable form represents the instance of ActionForm that is passed into the execute method as a parameter.
Originally posted by cathymala louis:

While I try to run the program. I am getting the following error message. Even though my action form has a getter and setter method.

You're getting this error message because the property in the JSP should be color, not Color.
[ August 16, 2007: Message edited by: Merrill Higginson ]
 
cathymala louis
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. As you told I changed Color to color it worked. Thank you again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic