Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to call a Servlet

Hi there,

I am new to Netweaver and I need to create a web-application based on JSP and Servlets. My project has got the following structure:

EAR-Project: Testproject

Webproject: ServletTest

- source:

public class IndexServlet extends HttpServlet{

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

PrintWriter pw = response.getWriter();

pw.println("<html><head>IndexServlet</head><body>Das ist der Text</body></html>");



- web.xml



<description>WEB APP description</description>




</servlet> <servlet>





- webContent: Index.jsp

<%@ page language="java" %>









I am the index content


<form name="formular" method="post" action="/IndexServlet">

<input type="submit" value="Go ..."/>




When I press the button in the jsp, I get a 404 error. Can someone help me to solve the problem? How do I call servlets by URL?

Thanks for help.



Former Member
Former Member replied

You get a 404 [Not found] error when the resource requested can not be found on the server. The reason could be

1. The requested resource does not exist on the server.

2. The path requsted is incorrectly mapped with the actual resource.

In case of your servlet, the only reason I can see is the incorrect mapping of your servlet. You need to have the following tag in your web.xml for correct mapping.





And in this case

<form name="formular" method="post" action="/IndexServlet">

must work.

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question