1

I have some Java Web Application and now it's starting from index.jsp page. I have my own class with following code:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class EntryPointClass extends HttpServlet {
    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    {
      ....
    }
}

My MANIFEST.MF file looks like:

Manifest-Version: 1.0
Main-class: asap.vito.mobileapi.EntryPointClass

But anyway, after deleting index.jsp I have a 404 error.

What should I change to start my app directly from my java class?

Thank you.

Andrey
  • 2,659
  • 4
  • 29
  • 54

2 Answers2

4

First of all its a servlet not simple java class... You should give its mapping into the web.xml and then u can access it directly

give this type of mapping for your servlet

<welcome-file-list>
  <welcome-file>entryPointClass </welcome-file>
 </welcome-file-list>
    <servlet>
            <servlet-name>EntryPointClass </servlet-name>//servlet name here
            <servlet-class>examples.EntryPointClass </servlet-class> // packagename.servletclassname
        </servlet>

        <servlet-mapping>
            <servlet-name>EntryPointClass </servlet-name>// servletname
            <url-pattern>/entryPointClass </url-pattern>  // url parttern by which you will access your servlet
        </servlet-mapping>

To access this from server use projectname/urlpattern

kirti
  • 4,499
  • 4
  • 31
  • 60
1

Change/Add Welcome File Tag Element in Web.xml Configuration or Use Servlet Mapping.

Lokesh
  • 313
  • 2
  • 12