Results 1 to 4 of 4
  1. #1
    afr31 is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default type Status report description The requested resource is not available

    After starting the Apache session when i type my User id and password in my proj i m gettin an error

    type Status report

    message /MAS/LoginForSession.com

    description The requested resource is not available.


    this is my web.xml file


    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app metadata-complete="true" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee">
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
    org.apache.webapp.admin.ApplicationServlet
    </servlet-class>
    <init-param>
    <param-name>application</param-name>
    <param-value>
    org.apache.webapp.admin.ApplicationResources
    </param-value>
    </init-param>

    <load-on-startup>1</load-on-startup>
    </servlet>



    <servlet-mapping>
    <servlet-name>admin.header_jsp</servlet-name>
    <url-pattern>/header.jsp</url-pattern>
    </servlet-mapping>


    <servlet>
    <servlet-name>LoginForSession</servlet-name>
    <servlet-class>
    LoginForSession
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>LoginForSession</servlet-name>
    <url-pattern>/LoginForSession.com</url-pattern>
    </servlet-mapping>


    <servlet>
    <servlet-name>DecideForSession</servlet-name>
    <servlet-class>
    DecideForSession
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>DecideForSession</servlet-name>
    <url-pattern>/DecideForSession.com</url-pattern>
    </servlet-mapping>


    <servlet>
    <servlet-name>MenuForSession</servlet-name>
    <servlet-class>
    MenuForSession
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>MenuForSession</servlet-name>
    <url-pattern>/MenuForSession.com</url-pattern>
    </servlet-mapping>

    <servlet>
    <servlet-name>Deposite</servlet-name>
    <servlet-class>
    Deposite
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Deposite</servlet-name>
    <url-pattern>/deposite.com</url-pattern>
    </servlet-mapping>

    <servlet>
    <servlet-name>Transfer</servlet-name>
    <servlet-class>
    Transfer
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Transfer</servlet-name>
    <url-pattern>/transfer.com</url-pattern>
    </servlet-mapping>

    <servlet>
    <servlet-name>Withdrawl</servlet-name>
    <servlet-class>
    Withdrawl
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Withdrawl</servlet-name>
    <url-pattern>/withdrawl.com</url-pattern>
    </servlet-mapping>

    <servlet>



    <servlet>
    <servlet-name>BalanceEnquiry</servlet-name>
    <servlet-class>
    BalanceEnquiry
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>BalanceEnquiry</servlet-name>
    <url-pattern>/balanceenquiry.com</url-pattern>
    </servlet-mapping>

    <servlet>



    <context-param>
    <param_name>driver</param_name>
    <param_value>oracle.jdbc.driver.OracleDriver</param_value>
    </context-param>



    <context-param>
    <param_name>url</param_name>
    <param_value>jdbc:oracle:thin:@localhost:1521:XE </param_value>
    </context-param>



    <context-param>
    <param_name>uname</param_name>
    <param_value>System</param_value>
    </context-param>


    <context-param>
    <param_name>password</param_name>
    <param_value>hr</param_value>
    </context-param>

    </web-app>


    plz help to solve the error

  2. #2
    afr31 is offline Member
    Join Date
    Oct 2012
    Posts
    2
    Rep Power
    0

    Default Re: type Status report description The requested resource is not available

    This is my HtMl file and i m using Oracle 10g as my database in which i have stored the username and password



    <html>

    <head>
    <title>Login.html</title>
    </head>

    <body bgcolor="gray">

    <form action="LoginForSession.com" method="post">
    <table align="center">

    <tr>
    <td>Enter the User Name :</td>
    <td><input type="text" name="t1"></td>
    </tr>

    <tr>
    <td>Enter the Password:</td>
    <td><input type="password" name="t2"></td>
    </tr>

    <tr>
    <td align="right">
    <input type="submit" value="LOGIN">
    </td>

    <td align="left">
    <input type="reset" value="CLEAR">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    and this is my servlet prog

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


    public class LoginForSession extends HttpServlet
    {

    String driverClass;

    String url;

    String userName;

    String password;

    Connection con=null;

    ServletContext scon;

    public void init(ServletConfig sc)
    {

    scon=sc.getServletContext();

    driverClass=scon.getInitParameter("driver");

    url=scon.getInitParameter("url");

    userName=scon.getInitParameter("uname");

    password=scon.getInitParameter("password");

    try{

    Class.forName(driverClass);

    con=DriverManager.getConnection(url,userName,passw ord);
    }
    catch(Exception ex)
    {

    }
    }


    public void doPost(HttpServletRequest request,HttpServletResponse response)
    throws ServletException,IOException
    {
    doGet(request,response);
    }

    public void doGet(HttpServletRequest request,HttpServletResponse response)
    throws ServletException,IOException
    {
    response.setContentType("text/html");

    PrintWriter out=response.getWriter();

    out.println("<html>");
    out.println("<head>");
    out.println("<title>First HTTP Servlet</title>");
    out.println("</head>");

    out.println("<body bgcolor=pink>");

    RequestDispatcher r=request.getRequestDispatcher("logo.html");

    r.include(request,response);


    HttpSession session=request.getSession(true);

    String userName=request.getParameter("t1");

    String password=request.getParameter("t2");

    if(userName!=null && password!=null)
    {
    try{
    String SQL="select acc_holder,acc_no,acc_balance from account where user_name=? and password=?";

    PreparedStatement stmt=con.prepareStatement(SQL);

    stmt.setString(1,userName);

    stmt.setString(2,password);

    ResultSet rs=stmt.executeQuery();

    if(rs.next())
    {
    session.setAttribute("uname",userName);

    session.setAttribute("accholder",rs.getString(1));

    session.setAttribute("accnumber",rs.getInt(2));

    session.setAttribute("accbalance",rs.getInt(3));

    session.setAttribute("todaysdate",new java.util.Date());

    RequestDispatcher rd=request.getRequestDispatcher("menuforsession.co m");

    rd.forward(request,response);
    }
    else
    {
    out.println("<font color=red size=15>You are not valid user</font>");
    }


    }
    catch(Exception ex)
    {

    }
    }
    else
    {
    out.println("<h1>Do Not try this.......!</h1>");

    out.println("<a href=LoginForSession.html><h2>Click here to go to login page</h2></a>");
    }

    out.println("</body>");


    out.println("</html>");
    }
    }

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: type Status report description The requested resource is not available

    Read BB Code List - Java Programming Forum and edit your posts accordingly.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: type Status report description The requested resource is not available

    Please use [code] tags [/code] when posting code.
    Few people will read unformatted code.

    Is your app called MAS?
    I notice your Servlet is not in a package.
    That's bad practice.

    I also notice you are eating exceptions in your servlet.
    Do not do that.
    At the very least do printStackTrace(), though preferably use a proper logging system.
    ALso you have made your connection an attribute of the servlet. This is wrong. Servlets should not have attributes. They are not thread safe.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. how to fix "description the requested resource () is not available"
    By unname2010 in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 05-25-2012, 10:39 AM
  2. HTTP Status 500 - type Exception report
    By gladiator in forum Java Servlet
    Replies: 1
    Last Post: 04-19-2011, 06:52 AM
  3. 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
  4. HTTP Status 500 - type Exception report - TOM CAT
    By hari krishna in forum Java Servlet
    Replies: 6
    Last Post: 10-16-2010, 04:06 PM
  5. HTTP Status 500 - type Exception report
    By sini.sep87 in forum Java Servlet
    Replies: 15
    Last Post: 11-17-2009, 03:18 PM

Posting Permissions

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