Go Back   Java Programming Forums > Java EE (Enterprise Edition) > JavaServer Pages: JSP & JSTL


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 15-12-2009, 04:12 PM
-_- -_- is offline
Junior Member
 

Join Date: Dec 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
-_- is on a distinguished road
Default how to delete record from checking checkbox value.

i would like to use jsp and java to write a add/edit/delete function.

I am a beginner, now i dont know how to create a java as a database layer in which i connect to database and write sql statement to insert/delete/update the table.

afterwards, i would like to use jsp to create a layout.

now , I don't know how to check the checkbox value from the table and then the user click the delete button to delete all ticked record in the table.

I already write the code in jsp as belows:
Java Code
<INPUT TYPE="submit" value="Delete" onClick="">
while(rs.next())
    {
     %>
     <tr><td><%=rs.getString(1) %></td>
     <td><%=rs.getString(2) %></td>
     <td><%=rs.getString(3) %></td>
     <td><center><input type="checkbox" name="del" ></center></td></tr>
     
     
  <%




Last edited by helloworld922; 12-03-2010 at 01:25 PM.
Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
  #2 (permalink)  
Old 02-03-2010, 11:17 AM
Junior Member
 

Join Date: Mar 2010
Location: Mauritius
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Wanderer is on a distinguished road
Default Re: how to delete record from checking checkbox value.

To use java to access the database, first please read about the JDBC apis.
and then learn how to use javascript to access DOM objects

Cheers
Reply With Quote
  #3 (permalink)  
Old 12-03-2010, 11:09 AM
Junior Member
 

Join Date: Mar 2010
Posts: 4
Thanks: 0
Thanked 3 Times in 2 Posts
heronfisher is on a distinguished road
Default Re: how to delete record from checking checkbox value.

If your page has a control something like this:

<input type="checkbox" name="idValue" value="${myObj.id}">


Then in the servlet that you go to when submitting the form:
String[] idsToDelete = request.getParameterValues("idValue");
That will give you an array of all the ids that were selected that need to be deleted.
Loop through that array, and delete them one by one.
__________________
acekard 2
Reply With Quote
The Following User Says Thank You to heronfisher For This Useful Post:
Json (15-03-2010)
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking in. Johannes Member Introductions 7 13-08-2009 11:11 AM
viewing a single record from database hundu JavaServer Pages: JSP & JSTL 1 05-07-2009 12:56 PM
setEnabled causing checkbox to deselect dewboy3d AWT / Java Swing 3 21-05-2009 04:36 PM
[SOLVED] checking if it is a character? luke File I/O & Other I/O Streams 10 20-05-2009 09:55 AM
checking individual digits of an int Konnor Java Theory & Questions 2 04-02-2009 04:24 PM


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 02:02 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.