可能这是一个简单的问题,但我不知道它的答案。
我有一个项目,myProject。在 webContent 中,我有 home.xhtml、leave.html 文件和另外 2 个文件夹:猫和狗。在cats 目录中我有一个页面cat.xhtml,在目录dogs 中我有一个页面dogs.xhtml。
我想从每个页面(家,猫,狗)转到页面 leave.html 在每个文件中都有一个commandLink
<h:form>
<h:outputLink value="leave.html" action="#{myBean.leave}">
<f:verbatim>Leave</f:verbatim>
</h:outputLink>
</h:form>
myBean
in 方法leave
返回一个字符串“leave”
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>leave</from-outcome>
<to-view-id>/leave.html</to-view-id>
</navigation-case>
</navigation-rule>
但这不起作用。我还尝试使用<to-view-id>../leave.html</to-view-id>
或添加一个新文件夹 leave 并放入 leave.html 页面。我用过<to-view-id>/leave/leave.html</to-view-id>
或
<to-view-id>/../leave.html</to-view-id>
但都有相同的结果 HTTP Status 404 /myProject/cats/leave.htlm type Status report
消息 /myProject/cats/leave.htlm
描述 请求的资源 (/myProject/cats/leave.htlm) 不可用。