• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inserting multiple checkbox values into a table

 
jaya-shree
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a JSP Page which is required to insert record into two tables simultaneously.This page allows the user to add a grp and grant access rights to applications for that particular grp code.
This page also has checkboxes for each application that i am listing on the page. How do i write an insert query which allows me to insert the names of those applications into the table which are checked and also the group code.There are two tables and both the tables are linked using the group code.
 
k b
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do like this:--
Let 1st Jsp ( having grp code and applications) do a submit to another Jsp say controller.jsp.

<form name="1stjsp" action="controller.jsp" method="POST">
In controller.jsp
You can retrieve those parameters using
request.getParameter(), request.getParameterNames() ( This is helpful when we have checkboxes and depends how you have coded the names for them).
Then do JDBC connection and write/insert into tables.
Finally when you are done we can forward back to the 1st page or another page using jsp forward tag.
<jsp:forward page="someother.jsp" />
Hope this helps.


 
Raja Shekhar
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi J-Shree
just try this...
Store the name of the group in the Value atrribute of the
Check Box..

and Check whether check box is Checked /not..
if (check != null)
then just insert...
and let me know it works..

Raj
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic