Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Default The requested resource (/InsertDataAction/) is not available.

    This is my servlet application.

    InsertDataAction.java

    package javacode;

    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;

    public class InsertDataAction extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws
    ServletException, IOException{
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    System.out.println("Insert data Example!");
    String driver = "oracle.jdbc.driver.OracleDriver";
    String url = "jdbc:oracle:thin@localhost:1521";

    String userName = "SYSTEM";
    String password = "SYSTEM";
    Connection con = null;
    try{
    Class.forName(driver);
    con = DriverManager.getConnection(url,userName,password) ;
    try{
    Statement st = con.createStatement();
    String firstname=request.getParameter("empname");
    String midname=request.getParameter("midname");
    String lastname=request.getParameter("lastname");
    String contect=request.getParameter("address");
    String dob=request.getParameter("dob");
    String eml=request.getParameter("email");
    String position=request.getParameter("position");
    String comname=request.getParameter("comname");
    String salary=request.getParameter("salary");
    String teleno=request.getParameter("teleno");
    String mobileno=request.getParameter("mobileno");
    String state=request.getParameter("state");
    String city=request.getParameter("city");
    int val = st.executeUpdate("insert empdetail values('"+firstname+"','"+midname+"','"+lastname+" ','"+contect+"','"+dob+"','"+eml+"','"+position+"' ,'"+comname+"','"+salary+"','"+teleno+"','"+mobile no+"','"+state+"','"+city+"')");

    con.close();
    out.println("success");
    }
    catch (SQLException ex){
    System.out.println("SQL statement is not executed!");
    }
    }
    catch (Exception e){
    e.printStackTrace();
    }

    }
    }

    web.xml

    <web-app>
    <servlet>
    <servlet-name>insertDataAction</servlet-name>
    <servlet-class>javacode.InsertDataAction</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>insertDataAction</servlet-name>
    <url-pattern>/InsertDataAction</url-pattern>
    </servlet-mapping>
    </web-app>

    employee.html

    <html>
    <head>
    <title>employee form in servlets</title>
    </head>
    <body>
    <center>
    <table border="0" width="600px" bgcolor="lightblue" cellpadding="2" cellspacing="4">
    <tr>
    <td width="100%">
    <form method="GET" action="InsertDataAction" onsubmit="return validateForm(this);">

    <h2 align="center" align="top">Employee Registration Form</h2>
    <table border="0" width="100%">
    <tr>
    <td width="50%"><b>Employee Name:</b></td>
    <td width="50%"><input type="text" name="empname" size="20"/> </td>
    </tr>
    <tr>
    <td width="50%"><b>Middle Name:</b></td>
    <td width="50%"><input type="text" name="midname" size="20"/> </td>
    </tr>
    <tr>
    <td width="50%"><b>Last Name:</b></td>
    <td width="50%"><input type="text" name="lastname" size="20"/> </td>
    </tr>
    <tr>
    <td width="50%"><b>Address:</b></td>
    <td width="50%"><input type="text" name="address" size="50"/> </td>
    </tr>

    <tr>
    <td width="50%"><b>Date Of Birth:</b></td>
    <td width="50%"><input type="text" name="dob" size="20"/> </td>
    </tr>
    <tr>
    <td width="50%"><b>E-mail:</b></td>
    <td width="50%"><input type="text" name="email" size="30"/> </td>
    </tr>
    <tr>
    <td width="50%"><b>Position:</b></td>
    <td width="50%"><input type="text" name="position" size="20"></td>
    </tr>
    <tr>
    <td width="50%"><b>Company Name:</b></td>
    <td width="50%"><input type="text" name="comname" size="25"></td>
    </tr>
    <tr>
    <td width="50%"><b>Salary:</b></td>
    <td width="50%"><input type="text" name="salary" size="20"></td>
    </tr>

    <tr>
    <td width="50%"><b>Telephone No:</b></td>
    <td width="50%"><input type="text" name="teleno" size="20"></td>
    </tr>

    <tr>
    <td width="50%"><b>Mobile Number:</b></td>
    <td width="50%"><input type="text" name="mobileno" size="20"></td>
    </tr>

    <tr>
    <td width="50%"><b>State:</b></td>
    <td width="50%"><input type="text" name="state" size="15"></td>
    </tr>

    <tr>
    <td width="50%"><b>City:</b></td>
    <td width="50%"><input type="text" name="city" size="10" maxlingth="15"></td>
    </tr>
    </table><center><p>
    <input type="submit" value="Submit" name="submit">
    <input type="reset" value="Reset" name="reset">
    </center></form> </td> </tr>
    </table></center></body></html>


    can any one help me please
    Last edited by DarrylBurke; 02-22-2012 at 04:15 PM. Reason: Removed annoying size 5 font

Similar Threads

  1. The requested resource () is not available
    By hartmannr76 in forum JavaServer Faces (JSF)
    Replies: 2
    Last Post: 05-31-2012, 08:39 AM
  2. HTTP Status 404-The requested resource is not available.
    By DeViLHuNTeR in forum Java Servlet
    Replies: 17
    Last Post: 03-11-2011, 03:40 PM
  3. The requested resource () is not available. Error
    By shyameni in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-17-2010, 10:22 AM
  4. The requested resource is not available.
    By ravichandra.t in forum Java Servlet
    Replies: 0
    Last Post: 07-29-2009, 03:18 PM
  5. The requested resource (/Test.war/index.jsp) is not available.
    By rameshraj in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 04-06-2009, 12:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •