如果JSF页面位置发生变化,Primefaces树表将无法展开



Primefaces树表扩展,如果我的xhtml网页是在WebContent文件夹,但它不扩展,如果我移动到相同的网页WEB-INF/views/jsf文件夹。我是JSF的新手,我不知道在什么地方和什么地方需要修改。

如果我的网页是在WEB-INF/views/jsf文件夹只有根节点是可见的。如果我点击它,它不会展开

<标题>
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
<h:head>
    <f:facet name="first">
        <meta http-equiv="X-UA-Compatible" content="IE=9" /> 
    </f:facet>
</h:head>
<h:body class="page">
    <h:outputStylesheet name="philos.css" />
    <h:outputStylesheet name="primefaces.css" />
    <h:form>
        <p:treeTable value="#{treeView.newRoot}" var="document" id="treeTable" >
            <p:column headerText="Name">
                <h:outputText value="#{document.name}" />
            </p:column>
            <p:column headerText="Size">
                <h:outputText value="#{document.size}" />
            </p:column>
            <p:column headerText="Type">
                <h:outputText value="#{document.type}" />
            </p:column>
        </p:treeTable>
    </h:form>
</h:body>
</html>
<标题>管理Bean h1> -servlet.xml h1> web . xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0">
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/*-Config.xml</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
</context-param>
<filter>
    <filter-name>SetCharacterEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>SetCharacterEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!-- CERT Implementation START -->
  <filter>
    <filter-name>csrfFilter</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    <async-supported>true</async-supported>
</filter>
<filter-mapping>
    <filter-name>csrfFilter</filter-name>
    <url-pattern>/mycompany/*</url-pattern> 
</filter-mapping>
<!-- CERT Implementation END -->
  <session-config>
    <session-timeout>60</session-timeout>
  </session-config>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <listener>
    <listener-class>
        org.springframework.web.context.request.RequestContextListener
    </listener-class>
  </listener>
    <display-name>systemAttribute</display-name>
    <servlet>
        <servlet-name>systemAttribute</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>systemAttribute</servlet-name>
        <url-pattern>/mycompany/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
    <!-- CERT Implementation START -->
  <error-page>
    <error-code>403</error-code>
    <location>/unauthorizedPage.jsp</location>
</error-page>
<!-- CERT Implementation END -->
</web-app>

我也有这个问题。我确实采取了以下步骤:步骤1:将XHTML文件移动到webcontent文件夹中。步骤2:由于webcontent中的所有文件都允许公众访问,因此出于安全原因,您需要在web.xml中添加以下条目。

请点击链接查看安全限制:通过将复合组件放在/WEB-INF

中来防止对它们的直接访问

相关内容

  • 没有找到相关文章

最新更新