Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

By default index.jsp is getting called instead of my login page

 
Shiva Gajjala
Ranch Hand
Posts: 77
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,I have extracted struts-blank.war and working on struts.I have created a login.jsp page and placed inside pages folder . Here it is,


</xml>
I want my login page to be executed by default as welcome page when I use the URL http://localhost:8080/Tracker ,where Tracker is my project name.
My web.xml file is as below.

And my struts configuration file (struts-config.xml) is below.


and index.jsp is,


I haven't mentioned <welcome-file-list> anywhere . I dont understand how index.jsp is called by default when I use the above URL. In the <global forwards> ,I changed the path to "/pages/login.do" ,but still index.jsp is called . First of all, index.jsp is not written anywhere (web.xml & Struts configuration file) .This question might be silly, but I just wanted to know what is happening internally. What exactly service() method of ActionServlet is doing.
 
Joe Ess
Bartender
Posts: 9300
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the Servlet Specification, the behavior is server-dependent if you do not declare a welcome file. For example, the Glassfish docs say:
If no welcome file is specified, the GlassFish Server will use a file named index.html as the default welcome file. If there is no welcome file and no file named index.html, the GlassFish Server returns a directory listing.

JEE Tutorial

Since a servlet container knows nothing about Struts, you cannot rely on a Struts configuration to determine what file is displayed by default.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic