0

I need a help with getting right path so that my request from a JSP page to a servlet works fine. Right now its giving me an error Servlet not found .. I am working in eclipse. My directory is like this ::

At the top level is my Project_Name 2_8_2012. Now inside JavaResources i have a Src folder inside which i have a package Mypackage inside which i have a TimeServlet.java and TimeManagement.java. 

my JSP page is in WebContent/jsp/Page.jsp

Now from Page.jsp i send a request on input submit button click. Basically a form is submitted

<form  id="timeform" name="timeformname" action="/2_8_2012/jsp/timeservlet" method="post">

which goes to my web.xml where i have this code ::

<servlet>
    <servlet-name>Timeserv</servlet-name>
    <servlet-class>  
            MyPackage.TimeServlet  
        </servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Timeserv</servlet-name>
    <url-pattern>/2_8_2012/jsp/timeservlet</url-pattern>
  </servlet-mapping>

but i get the error servlet not found.

To open a page.jsp on my browser i go to link

http://localhost:8080/2_8_2012/jsp/Page.jsp.

and it opens fine.

How should i give a path so that my servlet is called up ? Thanks..

Shantanu Tomar
  • 1,572
  • 7
  • 38
  • 64

1 Answers1

0

change the URL-PAttern to

/jsp/timeservlet and check

Satya
  • 8,693
  • 5
  • 34
  • 55