File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes can't use custom URLs in the welcome-file tag of web.xml? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "can Watch "can New topic
Author

can't use custom URLs in the welcome-file tag of web.xml?

Stephen Lee
Ranch Hand

Joined: Dec 11, 2001
Posts: 74
I am now using tomcat as the web container of jsp file. In the web.xml, I have set the welcome page as loginPage which is a custom URL of the login.jsp.
<servlet>
<servlet-name>loginjsp</servlet-name>
<jsp-file>/login.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>loginjsp</servlet-name>
<url-pattern>/loginPage</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>loginPage</welcome-file>
</welcome-file-list>
However, when I access the http://localhost, the list of all the files of the corresponding directory is listed. The loginPage does not appear. However, when I change the loginPage to login.jsp in the <welcome-file> tag, the login.jsp appears. Why? the tag cannot allow the use the custom URL? How can I solve the problem that I don't want the link the jsp file appears in the browser. Thanks!
Stephen
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
What sort of resource is loginpage? Is it as JSP page or static HTML, a servlet, or what? I have used a custom page in the welcom page list with no issues, but it was a JSP page of my own creation.
Stephen Lee
Ranch Hand

Joined: Dec 11, 2001
Posts: 74
My loginpage is JSP page. All of my setting are shown in my first message. Am I correct to use "loginPage" in the welcome page list?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Try using loginpage.jsp. You are telling Tomcat what page to look for when a web application is loaded. If you don't tell it the ".jsp" portion, it won't be able to find the page.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: can't use custom URLs in the welcome-file tag of web.xml?
 
Similar Threads
Not being able to locate TLD file?
Aliasing in tomcat for a jsp
welcome-file-list... A BUG?
How can I disable the call to jsp file?
JSF file as welcome-file in web.xml