I need a submitting form but I don't know how to go about it. Do I have to
have a servlet or can I use just 2 jsp pages. I want to input text a
deviceid in a jsp and then have it report back all the problems associated
with that id - which could be more than one. Any ideas for the other jsp
form or servlet would be apprecited thanks - also is my select statement
correct for me to enter the deviceid on another? Thanks M
[EMAIL PROTECTED]
<HTML>
<BODY>
<!--importing packages starts-->
<%@ page info="database handler"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.servlet.*"%>
<%@ page import="javax.servlet.http.*"%>
<!--importing packages ends-->
<%
Connection dbCon;
Statement stmt;
ResultSet rs;
String fdeviceid = request.getParameter("fdeviceID");
// Connection using MySQL
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
dbCon = DriverManager.getConnection("jdbc:oracle:etc.....");
}
catch (ClassNotFoundException e){
System.out.println("Database driver not found: " + e);
throw new UnavailableException(this, "Database driver not found");
}
catch (SQLException e) {
System.out.println("Error connecting to oracle: " + e);
throw new UnavailableException(this, "Error connecting to oracle");
} // try
// Query for memberID
try {
stmt = dbCon.createStatement();
rs = stmt.executeQuery("SELECT * from repair_history where fdeviceid = '" +
fdeviceid + "'");
out.println("<B>Device ID:</B>" + fdeviceid + "was found.");
rs.close();
dbCon.close();
}
catch (SQLException e){
System.out.println("Device ID query failed: " + e);
throw new ServletException("Device ID query failed.", e);
}
%>
</body>
</html>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets