无法重定向到web-inf文件夹。找不到资源

时间:2018-11-06 11:51:47

标签: spring spring-mvc http-status-code-404 facelets

我在尝试访问显示404错误的应用程序时遇到问题,找不到资源。我正在使用Spring 5,Maven和NetBeans dispatcher-servlet.xml

protected abstract void OnWriteAddressHeaderContents(XmlDictionaryWriter writer);

protected virtual void OnWriteStartAddressHeader(XmlDictionaryWriter writer);

web.xml

  <bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
    <property name="prefix" value="/WEB-INF/" />
    <property name="suffix" value=".xhtml" />
</bean>

/ web pages / index.jsp

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/config/root-config.xml </param-value>
</context-param>

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/config/root-config.xml </param-value>
</context-param>

<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet><welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>*.xhtml</param-value>
</context-param>

login.xhtml

<% response.sendRedirect("pages/login");%>

pom.xml(Maven)

1 个答案:

答案 0 :(得分:0)

您的login.xhtml文件位置应为/web WEB-INF/pages/login.xtml