can't use custom URLs in the welcome-file tag of web.xml?
Stephen Lee
Ranch Hand
Joined: Dec 11, 2001
Posts: 74
posted
0
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
posted
0
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
posted
0
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
posted
0
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.