jsf primefaces如何导航到up文件夹中的页面

jsf primefaces如何导航到up文件夹中的页面,jsf,primefaces,Jsf,Primefaces,我无法找到如何导航到位于上目录中的页面。有可能吗? 以下是我的项目结构: 问题: 在文件夹主页的任何页面的代码中,行应该如何包含索引.xhtml,以及如何插入,即图像文件夹中的图像(我无法获得正确的路径,io.exception仍然): xhtml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.

我无法找到如何导航到位于上目录中的页面。有可能吗? 以下是我的项目结构:

问题: 在文件夹主页的任何页面的代码中,行
应该如何包含
索引.xhtml
,以及如何插入,即图像文件夹中的图像(我无法获得正确的路径,io.exception仍然): xhtml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      >
    <h:body>

        <ui:composition template="web2/web/index.xhtml">

            <ui:define name="centerContent">
                    <h:form>
                        <p:growl id="msg" showDetail="true" sticky="true" />
                        <p:panelGrid styleClass="myPanel">
                            <p:row>
                                <p:column>
                        <ui:param name="mainTag" value="Z chęcią odpowiemy" />
                <h2>Zapytaj</h2>
                        <h4>#{mainTag}</h4></p:column>
                            </p:row>
                            <p:row>
                                <p:column><p:inputTextarea styleClass="myTextArea" autoResize="true" value="#{mySendBean.mailContent}"/></p:column>
                                <p:column>
                        <h:commandButton actionListener="#{mySendBean.sendMail2()}" value="Wyślij" update="msg">
            </h:commandButton>
                                    </p:column>
                            </p:row>
                        </p:panelGrid>
                    </h:form>
            </ui:define>


        </ui:composition>

    </h:body>

</html>

扎皮塔吉
#{mainTag}
当我将作文改为:

<ui:composition template="#{request.contextPath}/index.xhtml">

我得到一个错误:

/onas.xhtml @11,74 <ui:composition template="#{request.contextPath}/index.xhtml"> Invalid path : /web2/faces/index.xhtml
/onas.xhtml@11,74无效路径:/web2/faces/index.xhtml
或者如果我添加/faces/:

/onas.xhtml @11,74 <ui:composition template="#{request.contextPath}/faces/index.xhtml"> Invalid path : /web2/faces/index.xhtml
/onas.xhtml@11,74无效路径:/web2/faces/index.xhtml
组件中的所有路径对于webcontent根目录(即“Web页面”文件夹)都是绝对路径。此外,您应该更喜欢使用以
/
开头的绝对路径,而不是相对路径

因此,这应该做到:

<ui:composition template="/index.xhtml">

#{request.contextPath}
仅在您想要手动创建URL(用于最终用户)时才是必需的。
/faces
仅当您希望在其上调用JSF映射时才是必需的

另见:

与具体问题无关建议将模板文件放在
/WEB-INF
文件夹中,以防止直接访问

另见:

您是否尝试过requestContextpath?重复内容:这不适用于me@RongNK看更新:你可能会考虑不投票和UpvTeI认为你应该通过互联网进行研究,这是一个热门的问题,不仅仅是JSF,我因为这个原因被否决了,对不起,如果它让你无聊!非常感谢你。我把它改成了我的子页面,然后从主页、菜单加载到内容中心。然而,加载此页面似乎会影响主页面,因为例如,没有css(如果我不是从主页面文件夹加载子页面,而是从索引所在的文件夹加载子页面,则仍然如此),例如,缺少图片(在主页面(索引模板)中声明)不在作文中,怎么可能呢?不客气。至于你的新问题:如果你还没有回答,请按
提问
按钮。这与当前提出的问题无关。