Hey guys!~
the code below is generating this error message "Type mismatch: cannot convert from int to ResultSet" there is no integer types in the database i have made sure they are all strings. I tried making a JavaBean and then just calling it frmo the JSP but when compiling the Bean i got a similar error message suggesting that the ResultSet return value was an int has it got somethign to do with executeUpdate? is there another way to insert the info from the form to the SQL database?
anyhelp would do awesome as my J2EE tutors are stumped :D
Cheers!
[jsp]
<hr>
<%
String username = request.getParameter("username");
String password = request.getParameter("password");
String usertype = request.getParameter("usertype");
String email = request.getParameter("email");
String title = request.getParameter("title");
String firstname = request.getParameter("firstname");
String lastname = request.getParameter("lastname");
String phone = request.getParameter("phone");
String address = request.getParameter("address");
String state = request.getParameter("state");
String post = request.getParameter("post");
String country = request.getParameter("country");
String dob = request.getParameter("dob");
String credit = request.getParameter("credit");
String expiry = request.getParameter("expiry");
String login_date = request.getParameter("login_date");
%>
<%@ page import= "java.sql.*"%>
<%@ page import= "java.util.*"%>
<%@ page import= "java.lang.Integer"%>
<%@ page import= "javax.servlet.*"%>
<%@ page import= "javax.servlet.http.*"%>
<%@ page import= "java.io.*"%>
<%@ page import= "com.DBConnection"%>
<jsp:useBean id="dbbean" scope="application" class="com.DBConnection"/>
<html>
<head>
<title>Surf @ La Trobe - Registration Sign up</title>
</head>
<body bgcolor = "white" >
<%
%>
<h1> Registration !!!!! </h1>
<FORM ACTION= "play.jsp" METHOD= "POST">
<table width="302" height="462">
<tr>
<td height="54" width="79"> Username: </td>
<td height="54" width="211">
<input type= 'TEXT' name='username' size='30'>
</td>
</tr>
<tr>
<td height="45" width="79">Password:</td>
<td height="45" width="211">
<input type='PASSWORD' name='password'size='20'>
</td>
</tr>
<tr>
<td height="46" width="79">Verify Password:</td>
<td height="46" width="211">
<input type= 'PASSWORD' name='Verify Password' size='20'>
</td>
</tr>
<tr>
<td height="51" width="79">Type Of Member:</td>
<td height="51" width="211">
<input type= 'TEXT' name='usertype' size='20'>
</td>
</tr>
<tr>
<td height="51" width="79">Title:</td>
<td height="51" width="211">
<input type= 'TEXT' name='title' size='20'>
</td>
</tr>
<tr>
<td height="51" width="79">Name:</td>
<td height="51" width="211">
<input type= 'TEXT' name='firstname' size='20'>
</td>
</tr>
<tr>
<td height="51" width="79">Name:</td>
<td height="51" width="211">
<input type= 'TEXT' name='lastname' size='20'>
</td>
</tr>
<tr>
<td height="44" width="79">Phone:</td>
<td height="44" width="211">
<input type= 'TEXT' name='phone' size='20'>
</td>
</tr>
<tr>
<td height="94" width="79">Address: </td>
<td height="94" width="211">
<textarea name="address" cols="20" rows="3"></textarea>
</td>
</tr>
<tr>
<td height="46" width="79">email:</td>
<td height="46" width="211">
<input type= 'TEXT' name='email' size='20'>
</td>
</tr>
<tr>
<td height="46" width="79">State:</td>
<td height="46" width="211">
<input type= 'TEXT' name='state' size='20'>
</td>
</tr>
<tr>
<td height="46" width="79">Post Code</td>
<td height="46" width="211">
<input type= 'TEXT' name='post' size='20'>
</td>
</tr>
<tr>
<td height="46" width="79">Country</td>
<td height="46" width="211">
<input type= 'TEXT' name='country' size='20'>
</td>
</tr>
<tr>
<td height="46" width="79">Date Of Birth:</td>
<td height="46" width="211">
<input type= 'TEXT' name='dob' size='20'>
</td>
</tr>
<tr>
<td height="46" width="79">Credit Card:</td>
<td height="46" width="211">
<input type= 'TEXT' name='credit' size='20'>
</td>
</tr>
<tr>
<td height="46" width="79">Expiry Date:</td>
<td height="46" width="211">
<input type= 'TEXT' name='expiry' size='20'>
</td>
</tr>
<tr>
<td height="46" width="79">Login Date:</td>
<td height="46" width="211">
<input type= 'TEXT' name='login_date' size='20'>
</td>
</tr>
<tr>
<td height="25" width="79"></td>
<td height="25" width="211">
<input type='SUBMIT' size='10' value='SUBMIT' name="SUBMIT">
</td>
</tr>
<%
if(request.getMethod().equals("POST"))
{
DBConnection db = new DBConnection();
Connection con = db.getConnection();
%>
<h1> test?</h1>
<%
Statement statement = con.createStatement();
ResultSet rs = statement.executeUpdate(" INSERT INTO USERS VALUES( '"+username+"','"
+password+"','"+ usertype +"','"+ email +"','"+ title +"','"+ firstname +"','"+ lastname +"','"
+ phone +"','"+ address +"','"+ state +"','"+ post +"','"+ country +"','"+ dob +"','"+ credit +"','"
+ expiry +"','"+ login_date+"'");
}
else
{
out.println("<h1>something went wrong</h1>");
}
%>
</table>
</form>
</body>
</html>
[/jsp]