• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Stephen Lee
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!