Servlet not running on j2sdkee 1.4

Discussion in 'Java' started by ajay.partoti@gmail.com, May 3, 2006.

  1. Guest

    I am using: j2sdk1.4.1
    with j2sdkee1.4(with application server)
    The program code is:
    html file code:
    <html>
    <body>
    <form method="post"
    action="http://localhost:8080/check/servlet/GetServlet">


    <input type="text" name="ajay">

    <input type="submit" name="submit">
    </form>
    </body>

    </html>
    Servlet code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;

    public class GetServlet extends HttpServlet
    {
    public void doPost(HttpServletRequest req,HttpServletResponse res)
    throws ServletException,IOException
    {
    String s = req.getParameter("ajay");

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

    out.println("<html><body>" + "HI" + s + "</body></html>");
    out.close();
    }
    }

    But the above code is not working after proper deployment
    It gives servlet path error.
    that the resource GetServlet is not found under /check/GetServlet.
    I don't know what the problem is?
    Please help!
     
    , May 3, 2006
    #1
    1. Advertising

  2. On 3 May 2006 02:10:23 -0700, <> wrote:

    > I am using: j2sdk1.4.1
    > with j2sdkee1.4(with application server)
    > The program code is:
    > html file code:
    > <html>
    > <body>
    > <form method="post"
    > action="http://localhost:8080/check/servlet/GetServlet">
    >
    >
    > <input type="text" name="ajay">
    >
    > <input type="submit" name="submit">
    > </form>
    > </body>
    >
    > </html>
    > Servlet code:


    *** Put all servlet related classes in a package
    Not using a package causes all sorts of problems


    > import javax.servlet.*;
    > import javax.servlet.http.*;
    > import java.io.*;
    >
    > public class GetServlet extends HttpServlet
    > {
    > public void doPost(HttpServletRequest req,HttpServletResponse res)
    > throws ServletException,IOException
    > {
    > String s = req.getParameter("ajay");
    >
    > PrintWriter out = res.getWriter();
    > res.setContentType("text/html");
    >
    > out.println("<html><body>" + "HI" + s + "</body></html>");
    > out.close();
    > }
    > }
    >
    > But the above code is not working after proper deployment
    > It gives servlet path error.
    > that the resource GetServlet is not found under /check/GetServlet.
    > I don't know what the problem is?
    > Please help!
    >




    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
     
    William Brogden, May 3, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. steven
    Replies:
    1
    Views:
    321
    Dobromir Gaydarov
    Oct 25, 2003
  2. circuit_breaker
    Replies:
    2
    Views:
    2,013
    Jack Jia
    Apr 4, 2004
  3. Doug McCann
    Replies:
    1
    Views:
    1,029
    William Brogden
    Aug 5, 2004
  4. Replies:
    4
    Views:
    13,263
    Simon Brooke
    Nov 11, 2006
  5. Replies:
    4
    Views:
    789
Loading...

Share This Page