嗨,我对 JSF 2.1 中的导航规则有疑问。此配置适用于 JSF 1.2。在项目中使用了一些额外的库:JSF 2.1、RichFaces 4.2、Tomahawk、Spring 3.1、urlrewrite、acegi。
问题是:
我在浏览器 URL 中打开页面:localhost:8080/cat1/cat2,我看到 index.xhtml 页面。我正在填写表格并单击按钮,2 秒后我可以在 page.xhtml 上看到结果,一切正常,但浏览器中的 URL 有双斜杠。有 localhost:8080/cat1/cat2//index.xhtml 而不是 localhost:8080/cat1/cat2/page.xhtml 。
当我尝试单击 page.xhtml 上的某个链接时,由于 URL 中的双斜杠,我看到找不到页面。
在 page.xhtml 上,我再次有按钮计算,它调用相同的方法表单 bean。单击此按钮后响应正常,我的 URL 是 localhost:8080/cat1/cat2/page.xhtml 没有双斜杠。页面上的所有链接都有效。
当我输入 URL:localhost:8080/cat1/cat2/index.xhtml,然后单击按钮我可以看到我的 page.xhtml 但 URL 是 localhost:8080/cat1/cat2/ 并且页面上的所有链接都有效
我添加了这一行:
<from-action>#{bean.method}</from-action>
但没有帮助
我的 index.html 上的按钮:
<h:commandButton action="#{bean.method}" value="" styleClass="method right" tabindex="8" />
行动:
public String method() {
// few instruction
return "success";
}
规则:
<navigation-rule>
<from-view-id>/cat1/cat2/*</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/cat1/cat2/page.xhtml</to-view-id>
</navigation-case>
<!-- Here is more cases -->
</navigation-rule>
有没有人遇到过类似的问题?