Servlet [message #216303] |
Sat, 16 June 2007 06:42 |
Eclipse User |
|
|
|
Originally posted by: Shahriar.proqual.net
I am not sure if this question needs to be posted elsewhere, if
so...please advise. Thanks.
I am new to eclipse and am using resin. I am aboe to view my pages.
However, when I try to create a servlet, I am getting a 404. All files
seem to be in proper folders, etc.. This is my first try at servlet and
would like to make it work.
Many thanks in advance.
Shahriar
Here is my web.xml
<web-app>
<servlet-mapping>
<servlet-name>testservelet</servlet-name>
<url-pattern>/servlet/testservelet</url-pattern>
</servlet-mapping>
<servlet servlet-name="hello" servlet-class="mypackage.BasicServlet" />
<servlet-mapping servlet-name="/hello" url-pattern="/hello" />
</web-app>
my servlet...
package mypackage;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.IOException;
public class BasicServlet extends HttpServlet {
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws IOException {
ServletOutputStream out = res.getOutputStream();
res.setContentType("text/html");
out.println("<html><head><title>Basic Servlet</title></head>");
out.println("<body>Hi there</body></html");
}
}
my project name is book1...
so i test by using http://localhost:8080/book1 Works!
http://localhost:8080/book1/hello --> I get 404 Not found
|
|
|
Powered by
FUDForum. Page generated in 0.04430 seconds