Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 哪些XHTML文件需要放在/WEB-INF中,哪些不需要?_Jsf_Jsf 2_Facelets_Web Inf - Fatal编程技术网

Jsf 哪些XHTML文件需要放在/WEB-INF中,哪些不需要?

Jsf 哪些XHTML文件需要放在/WEB-INF中,哪些不需要?,jsf,jsf-2,facelets,web-inf,Jsf,Jsf 2,Facelets,Web Inf,在这些问题之后: 我写这些都是为了解决JSF2框架的一个“愚蠢”问题,即我不能直接链接到存储在/WEB-INF子文件夹中的页面。在那之后,我对Google和Stackoverflow做了一些研究,我知道了一件事:如何构造JSF2 web项目 特别是,我应该把XHTML页面放在哪里?最终用户确实无法公开访问/WEB-INF文件夹中的文件。所以你不能有类似http://localhost:8080/contextname/WEB-INF/some.xhtml。这将是一个潜在的安全漏洞,

在这些问题之后:

我写这些都是为了解决JSF2框架的一个“愚蠢”问题,即我不能直接链接到存储在
/WEB-INF
子文件夹中的页面。在那之后,我对Google和Stackoverflow做了一些研究,我知道了一件事:如何构造JSF2 web项目


特别是,我应该把XHTML页面放在哪里?

最终用户确实无法公开访问
/WEB-INF
文件夹中的文件。所以你不能有类似
http://localhost:8080/contextname/WEB-INF/some.xhtml
。这将是一个潜在的安全漏洞,因为最终用户将能够查看其他的
/WEB-INF/WEB.xml
等等

但是,您可以使用
/WEB-INF
文件夹将主模板文件、包含文件和标记文件放入。例如,下面的模板客户端
page.xhtml
,位于
/WEB-INF
之外,可通过
http://localhost:8080/contextname/page.xhtml

<ui:composition template="/WEB-INF/templates/template.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
>
    <ui:define name="content">
        ...
        <ui:include src="/WEB-INF/includes/include.xhtml" />
        ...
    </ui:define>
</ui:composition>

这是一个涉及facelets许多方面的突出问题。
<security-constraint>
    <display-name>Restrict direct access to the /resources folder.</display-name>
    <web-resource-collection>
        <web-resource-name>The /resources folder.</web-resource-name>
        <url-pattern>/resources/*</url-pattern>
    </web-resource-collection>
    <auth-constraint />
</security-constraint>