Hello Out there:
         Any Idea from anyone on the message I am getting when I tried
to access the below servlet?  I am running javawebserver1.1.3 on NT4.0.
I placed the below html code in the public_html directory that is
located in the webserver root directory and the java servlet class in
the servlets directory that is also located in the webserver root
directory.  Using the url "http://servername:8080/CustSvc.html gives me
the page and when I filled all the neccessary/required field, I get a
popup message saying that reads "form contains no data"----when I am
expecting the html code to access the java servlet code.   Some one
help, please.

Pat


(1)

<HTML>
<HEAD>
  <TITLE>Customer Service Request</TITLE>
</HEAD>
<BODY>
<CENTER><H1>Customer Service Request</H1></CENTER>
<HR>
<BR>
<FORM ACTION="http://localhost:8080/servlet/Login" METHOD="GET">
<CENTER>
<TABLE>
  <TR>
    <TD>First Name:</TD>
  <TD><INPUT TYPE="Text" NAME="txtFname" SIZE="30"></TD>
  </TR>
  <TR>
    <TD>Last Name:</TD>
    <TD><INPUT TYPE="Text" NAME="txtLname" SIZE="30"></TD>
  </TR>
  <TR>
    <TD>Email Address:</TD>
    <TD><INPUT TYPE="Text" NAME="txtEmail" SIZE="30"></TD>
  </TR>
  <TR>
    <TD>Phone Number:</TD>
    <TD><INPUT TYPE="Text" NAME="txtPhone" SIZE="30"></TD>
  </TR>
  <TR>
    <TD VALIGN="top">Request:</TD>
    <TD><TEXTAREA NAME="txtRequest" COLS="30" ROWS="10"></TEXTAREA></TD>

  </TR>
</TABLE>
<BR><INPUT TYPE="Submit" VALUE="Submit Request">
</CENTER>
</FORM>
</BODY>
</HTML>



(2)

//imports java servlet libraries
import javax.servlet.*;
import javax.servlet.http.*;

//imports libraries
import java.util.*;
import java.io.*;
import java.sql.*;

public class Login extends HttpServlet {
   Connection dbCon;
   public void init() throws ServletException {

        try {

            // Load the Oracle JDBC driver
           //DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
           Class.forName ("oracle.jdbc.driver.OracleDriver");
           dbCon=  DriverManager.getConnection
("jdbc:oracle:thin:@oracle.world:1521", "scott", "tiger");
        }
        catch (Exception e)
         {
              e.printStackTrace();
              System.err.println("Connection Error: "+e.getMessage());
              //return null;
         }
       }


   public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

      PrintWriter out = res.getWriter();
      res.setContentType("text/html");

      String fname = req.getParameter("txtFname");
      String lname = req.getParameter("txtLname");
      String email = req.getParameter("txtEmail");
      String phone = req.getParameter("txtPhone");
      String request = req.getParameter("txtRequest");

      /* Log request in database */
      try {
         Statement s = dbCon.createStatement();
         s.executeUpdate("insert into CustSvc values('" + fname +
                       "','" + lname + "','" + email + "','" + phone +
                       "','" + request + "','open')");
      } catch (SQLException e) {
         System.out.println(e.toString());
         return;
      }

      /* Send name field to next servlet in the chain */
      out.println(fname + " " + lname);
      out.close();
   }

   public void destroy() {
      /* Close database connection */
      try {
         dbCon.close();
      } catch (Exception e) {
         System.out.println("CustSvc: Error closing database
(destroy)");
         System.out.println(e.toString());
      }
   }
}

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to