Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
    Bookmark Topic Watch Topic
  • New Topic

simple form registration  RSS feed

 
mary bate
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Report post to moderator
desperate help really needed. i've been to many forums and still cant get the solution for this..can anyone help?
First of all..i juz want to make a simple form registration for users to enter data and click submit. to store data into oracle database and use toad to view. however, the database table doesnt show anything..are my codes wrong?

APPSFORM.JSP


<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>


<html>
<body>
<br>
<center>
<p>
<u><b><font size="5">For AppLicating Department</font></b></u>
</p>
<form method="post" action="appsdata.jsp" >
<table border="0">
<tr>
<td>Employee's Full name</td>
<td>
<input name="employee_name" value="" size="30"/>
</td>
</tr>
<tr>
<td>Employee's number</td>
<td>
<input name="employee_number" value="" size="30"/>
</td>
</tr>

<tr>
<td>Department Drive (G):</td>
<td>
<input type="radio" name="dept_drive_flag" value="yes">Yes
<input type="radio" name="dept_drive_flag" value="no">No
</td>

</table>


<br>
<input type="submit" value="Submit"/>
<input type="reset" value="Clear"/>
</form>
</center>
</body>
</html>


APPSDATA.JSP


<%@ page language="java"%>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>

<%
Connection con = null;
Statement stmt = null;
ResultSet rs = null;


String queryText = "insert into ttt values(\"" + request.getParameter("employee_name") + "\",\"" + request.getParameter("employee_number") + "\",\"" + request.getParameter("dept_drive_flag") + "\");";


try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc racle:thin:@15.12.88.202:1522:test", "apps", "apps");
stmt = con.createStatement();
rs = stmt.executeUpdate(querytext);
} catch (Exception e) {


%>

<%@ include file="fail.jsp"%>

<%

}

response.sendRedirect("success.jsp");

%>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not report the same question twice. Continue any discussion in the already-ongoing topic here.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!