简体   繁体   English

jsp欢迎文件未调用

[英]jsp welcome file not called

I have a JSP web application deployed to tomcat. 我有一个部署到tomcat的JSP Web应用程序。 The url of the application is http://servername/app 应用程序的URL是http:// servername / app

The web.xml contains welcome-file-list as below. web.xml包含welcome-file-list,如下所示。

<?xml version="1.0" encoding="UTF-8"?>
    <web-app id="mobile" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    </web-app>

Now, when we access http://servername/app the application is not accessible. 现在,当我们访问http:// servername / app时 ,无法访问应用程序。 But, if we access the url as http://servername/app/ , then the application is accessible. 但是,如果我们以http:// servername / app /访问该URL,则可以访问该应用程序。

I need the application to be application without the trialing / character. 我需要应用程序是没有试验/角色的应用程序。

Please help! 请帮忙!

This can happen when you've a servlet mapped on / which is taking over the job of the servletcontainer's builtin default servlet who is the one responsible for going to the right root path. 当你有一个servlet映射到/正在接管servletcontainer的内置默认servlet的工作时,就会发生这种情况,该servlet负责转到正确的根路径。 So either fix your servlet to do the same or map it on a more specific url pattern. 因此,要么修复servlet以执行相同操作,要么将其映射到更具体的url模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM