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

how to insert multiple check box data into database

 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to insert multiple check box data into database

String[] rval = request.getParameterValues("r");
used t get the values and i have to append , between each one and insert them into single column.


After that if i want to edit data then i have to get that data and show them in related check boxes to be checked


thanks.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your problem seems to be pretty straight forward. Are you looking for exact code to achieve your requirements ?

simple steps could be

1. define your table column as VARCHAR2 type.
2. grab the value of multple checkbox recieved from browser (variable - rval as shown in your post)
3. you can use String concentation operator to append comma between check box values
4. now update that string in table column

for showing that check box data back again,
1. fetch the table column value from database
2. tokenize the string using StringTokenizer using comma as seperator
3. send these individual check box value to jsp page using request or session

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic