Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Servlet
Servlet [message #216303] Sat, 16 June 2007 06:42
Eclipse UserFriend
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
Previous Topic:I can't open eclipse.YOU CAN HELP.Plz reply.
Next Topic:Accessing CVS
Goto Forum:
  


Current Time: Fri Apr 19 15:19:54 GMT 2024

Powered by FUDForum. Page generated in 0.04430 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top