| |

VerySource

 Forgot password?
 Register
Search
View: 1134|Reply: 1

How to use the default servlet configuration under tomcat without setting web.xml

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-25 14:00:01
| Show all posts |Read mode
What I mean is to write a servlet and place it under the classes of web-inf (note: there is no web.xml file under web-inf, this is for rapid development and testing of servlets)
I will modify the tomcat-install/confg/web.xml file according to the method in the book
Removed the comment below
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
<servlet-mapping>
Restart tomcat5.0
Then directly visit http://localhost/servlet/HelloWorld
But it reported an error, showing that the / directory cannot be accessed

Is it wrong to modify the web.xml file? Which master can help? Thank you
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-27 09:30:01
| Show all posts
Just set web.xml
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list