Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Radio Button,Check Boxes

 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Jsp and java i am inserting records in database through a form consisting of text fields,radio buttons and check boxes.The records r inserted successfully and displayed using jsp page.Now i want to modify a particular record where in i get all the values of the particular record stored in text fields but i dont know how to retrieve the status of radio buttons and check boxes stored in database through jsp.
Pls Help
 
Mathias Nilsson
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know you the form looks like when you are adding an item.
But let's say you have a form that looks like this

In the servlet you use request.getParameter to retrive the data entered.
When inserted into a database you normaly have an identity key. That means that a row in the table must be unique to retrive the data.
Here's an example table

// Mathias
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for text field value to modify , i get the value when i write in jsp--
<input name="txtlename" type="text" id="txtlenam" value="<%=leaveHandler.getleaverecord(Integer.parseInt(i),1)%>" >
but when i write the same for radio button or check it does not happen...
<input type="checkbox" name="carried" value="<%=leaveHandler.getleaverecord(Integer.parseInt(i),4)%>">
Pls help
 
Mathias Nilsson
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you viewed the source to see if doesn't have a value?
Right click the browser and select view source. Scroll down to the
checkbox.
If it has a value then it has nothing to do with CHECKED.
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i see source it has a value but it does not display in form.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic