• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic