• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

setting a page element

 
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");

}
%>
 
Marshal
Posts: 67478
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67478
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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?
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe something like this :




or not?
 
Bear Bibeault
Marshal
Posts: 67478
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic