1

所以,我已经在 J​​BOSS(Linux 机器)上部署了我的应用程序,当我尝试访问 URL 时,它给了我 404 错误。我在本地 JBOSS 上部署和测试的同一个应用程序可以完美运行。我的 Web.xml 文件:

<web-app 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">

    <display-name>Server-status Monitoring</display-name>

    <welcome-file-list>
        <welcome-file>WEB-INF\jsp\systemsettings\serverStatus.jsp</welcome-file>
    </welcome-file-list>


    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:WEB-INF/spring-mvc-servlet.xml</param-value>
    </context-param>

    <servlet>
        <servlet-name>spring-mvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring-mvc</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

    <jsp-config>

        <taglib>
            <taglib-uri>http://displaytag.sf.net</taglib-uri>
            <taglib-location>/WEB-INF/tlds/displaytag.tld</taglib-location>
        </taglib>

        <taglib>
            <taglib-uri>/gridtags</taglib-uri>
            <taglib-location>/WEB-INF/tlds/grid-converter-changed.tld</taglib-location>
        </taglib>


    </jsp-config>


</web-app>

我的 spring-mvc-servlet.xml 文件:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <bean name="/*.do" class="com.sterling.ag.controller.ServerStatusController">
        <property name="serverStatusFacade">
            <bean class="com.sterling.ag.facadeImpl.ServerStatusFacadeImpl" />
        </property>
    </bean>

    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/WEB-INF/jsp/systemsettings/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>


</beans>
4

1 回答 1

0

正如我们在您的 web.xml 中看到的那样

您正在使用WEB-INF\jsp\systemsettings\serverStatus.jsp

你应该使用WEB-INF/jsp/systemsettings/serverStatus.jsp

而不是“\”使用 “/”

于 2012-12-14T13:00:06.233 回答