0

I'm looking for the web.xml file in a Servlet 3.0 enviroment. The reason is because I want to change my welcome file from "index.jsp" to "hello.jsp".

I know that in the web.xml file, there is a welcome-file-list, and I want to change this setting so that the index.jsp URL mapping is changed to hello.jsp.

So, my question is, where is the web.xml file, or if there is no such file in Servlet 3.0, how can I change my URL mapping?

I would be very pleased to get the answer this question, thanks.

Perception
  • 79,279
  • 19
  • 185
  • 195
JK-Kim
  • 3
  • 3

3 Answers3

3

With servlet 3.0 its not always required, so if its not there you can add one in WEB-INF/web.xml

jmj
  • 237,923
  • 42
  • 401
  • 438
0

The web.xml file is created by yourself when the servlet created

Delay
  • 11
  • 1
0

In Servlet 3.0 web.xml file can be Omitt .

Immediate question is Then how to map ??

Like below using Annotations .

 @WebServlet(name = "MyServlet",
  urlPatterns = {"/myservlet"}, 
  initParams = {@WebInitParam(name="param1", value="value1")}
 )
 public MyServlet extends HttpServlet
 {

If you want to add welcome file and 400 ,500 status code exceptions ...blah blah ..

Create one with path WEB-INF/web.xml and give there .

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307