This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes By default index.jsp is getting called instead of my login page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "By default index.jsp is getting called instead of my login page " Watch "By default index.jsp is getting called instead of my login page " New topic
Author

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

Shiva Gajjala
Ranch Hand

Joined: May 02, 2014
Posts: 40

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

Joined: Oct 29, 2001
Posts: 8843
    
    7

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.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
 
subject: By default index.jsp is getting called instead of my login page
 
Similar Threads
Error in Struts " Invalid path was requested"
multiple struts config file with same action path.
The requested resource (/asherstruts-project/) is not available
exception while displaying a html:select component
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: