• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

do we need to include all the jsp files and servlet name in web.xml or just login page ?

 
nishant vaishnaw
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do we need to include all the jsp files and servlet name in web.xml or just login page is enough.

in my applcaition i have 200 jsp and 120 servlet so please guide any short way
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65342
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All servlets need to be declared and mapped.

If you want to reduce the clutter in the web.xml, consider using a Front Controller.

More info in this article.
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do we need to include all the jsp files and servlet name in web.xml or just login page is enough.


JSPs arent required in the web.xml provided you arent using a JSP as a raw servlet. The login page ( JSP or HTML or anything else ) has to be mentioned in the welcome page list of the web.xml. As for the servlets, yes every other servlet has to be mapped in the web.xml with a valid mapping url ( how else would you call them if you dont map them with a url and a name ) .

Having 200 JSPs is not an issue at all ( you can have many more ) , but yes, maintaining 120 servlets in the web.xml can be a bit of a difficult job . I suggest you take a look into the front controller pattern in which all requests coming from a client are entertained by a single controller servlet and then re-directed to the required task class. Take a look into struts framework here Link
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic