• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting a page element

 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
I have several radio buttons, and I'd like to set one of them to "checked" based on the value of request. Thanks in advance. So here is what I have so far:
<INPUT type="radio" name="C5" value="Plus">
<INPUT type="radio" name="C5" value="Plus To Max">
<INPUT type="radio" name="C5" value="Fixed">
<INPUT type="radio" name="C5" value="Other">
<%
if (request.getParameter("radio")!= null){
String c = request.getParameter("radio");

}
%>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64962
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to place the string checked="checked" on the input element that is to be checked.
 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, I'm new to jsp. Could you please tell me what the syntax would look like for what you're talking about?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64962
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per the forum instructions, what sever are you using, and what version of JSP?
 
Rodrigo Alvarez
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe something like this :




or not?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64962
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not. Adding the checked attribute to the element, regardless of its value, turns the checked property on.

The best sytnax to use will depend on the answer to my question regarding JSP version. EL for JSP 2.0, a scriptlet expression otherwise.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic