Win a copy of Terraform in Action this week in the Cloud forum!

JC Bismark

Greenhorn
+ Follow
since Jun 27, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by JC Bismark

I'm trying to get some hands on experience in Java.I have learn the
basic of java.I'm now reading Head First Servlet& JSP.
I would like to be able to get a job as software Developer,but
I know that without any experience or certification(SCJP) it hard.
Any tips to help me find:

1- links where I can contribute on any java's open project?

2- links where I can get voluntary job to built my experience?


Thank you in advance
12 years ago
My goal is to display all records from a mysql table (MemberDetails) using Deletemember.jsp page,then allows to check some of them for deletion using one checkBox per records display.

I was able to retrieve mysql table's data to Deletemember.jsp. Also using
a radio button I was able to delete one record at a time.Each record's button having the same name="bt1" with different value="<%=rs.getInt(1)%>".But now,each record have it's own checkBox's name.
From my code of JSP with radio button,the input type="radio" will be replace. I would get
<input type="checkBox" name="bt1">
<input type="checkBox" name="bt2">
<input type="checkBox" name="bt3">
--etc--
<input type="checkBox" name="btn">


How can I write the SQL statement in the HandlereplyModel.java to handle those different checkBoxes with their possible values( checked or not checked )?.

My code for the JSP and HandlereplyModel.java (case of a radio button):




The Deletemember.jsp code:



I also have a servlet as controller.
I will use getParameter like I did in the case of radio button :
String useID = req.getParameter("bt1"); to retrieve the info from the JSP .an object of the model class is created
HandlereplyModel hrm = new HandlereplyModel(); and the delete()method is call :
String successOrFailure = hrm.delete(useID);
13 years ago
you're right I should add this line :




-What's the best way to delete some records by using the checkBoxes and submit
I can use a another Servlet that control a modele class using DELETE method and the userId? what else is possible?
13 years ago
Jeanne,thank you for your clarifications.
I want to know if I'm in the right track,and also the next step to get the deletion of records with the checkBox checked.Here is my work :



-Does this bring all records with the checkbox for each record?

-For deletion,I have to create a servlet with doPost request and a model class that will do the deletion
Is that right?


-the CreateRecObj class needs to be created to use cro object in the Servlet. Is the following definition right?

13 years ago
We can put the key in the project,but since the requirement was to make appear the firstname,lastname,email and phone number only, with a checkBox on the left side of each record; the primary key userId has been added by me.
I was thinking that this key should appears in the JSP page as a value to the checkBox.Please,advise...

Also,in the JSP do I have to define a form or not?
How do we define a checkbox with each record?

Please,advise...
13 years ago
Jeanne or anyone else who want to help.

My Servlet looks like:



what about the field userId which is the primary key in MemberDetails,with
rs.getString(1) retrieving the first column ?
the result.setAttribute("records",result) allows the object to fast forward the records.
How to see all the records in a JSP table with a checkBox in front of each records allowing deletion of the checked one only,some thoughts?
13 years ago
Where do you put the object created in your servlet code.After the retreive
of ResustSet? what it looks like, is it something like this:

CreateRecObj cro = new CreateRecObj();

what's helper API? and if the key doesn't come from the ResultSet,how the key will appears in the object? what about the value?
13 years ago
Hello Jeanne,


Do I need to add the RequestDispacher to my servlet or not? I want to know if the output needs to appear directly in the servlet with pw.println...
or the retrieve of value are fast forward through the object you're talking about. Please,advise...
13 years ago
I'm not sure but I have an idea for the first part.Using your advise (Servlet)I retrieve records this way:





This servlet deploy should show only all the records ,but no checbox
in front of each record that allow deletion when checked.Do I use :

RequestDispatcher view = req.getRequestDispatcher("Deletemember.jsp");//client then sends it to the JSP file on the server
view.forward(req, res); instead of printing to output the records and forward the ResultSet to a JSP page with a form.I'm thinking about something like this:
13 years ago
I would like to retreive all 5 rows of mysql table "MemberDetails" to DeleteMember.jsp page.DeleteMember should allows to see the five records.
My MemberDetails table is already created with firstname,lastname,email,phonenum as columns.The jsp page shows the records and allow you to select (with checkboxes)the record(s) for deletion.When I clik submit it return index.jsp.Any thougths ...


I tried to do the DeleteMember.jsp but I'm not sure about using the result set and where to insert the checboxes.



[ November 23, 2008: Message edited by: Bear Bibeault ]
13 years ago
I found the error in my servlet that control this model class.Now I can insert values without duplicate in mysql table.
what's the syntax to delete all duplicate records already in my table?
please,advise...
Thank you Campbell and Paul.Good advises.I will continue to look for the problem...
Do I need to add the JDBC Driver path in the environment variables PATH?
I really need some help to solve this duplicate insert...

thanks,