您可以使用JSF faces配置导航控制浏览器后退按钮吗
您可以使用JSF faces配置导航控制浏览器后退按钮吗?当按下浏览器上的“后退”按钮时,您希望使用如下导航控制要显示的页面:您可以使用JSF faces配置导航控制浏览器后退按钮吗,jsf,back-button,Jsf,Back Button,您可以使用JSF faces配置导航控制浏览器后退按钮吗?当按下浏览器上的“后退”按钮时,您希望使用如下导航控制要显示的页面: <navigation-rule> <from-view-id>/pageThree.xhtml</from-view-id> <navigation-case> <from-outcome>back</from-outcome> <to-view-id>/page
<navigation-rule>
<from-view-id>/pageThree.xhtml</from-view-id>
<navigation-case>
<from-outcome>back</from-outcome>
<to-view-id>/pageOne.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
/pageThree.xhtml
返回
/pageOne.xhtml
不,你不能。使用HTML/JS已经不可能了,所以JSF在这里不能为您做很多事情
最好的选择是根据一些JS/ajax条件,在pageOne.xhtml中有条件地显示pageTwo.xhtml的内容。这样,浏览器历史记录中就没有对pageTwo.xhtml的GET请求
下面是一个简单JS的基本启动示例:
<div id="one">
<h1>Page one</h1>
<p><a href="#" onclick="showPageTwo()">Go to page two</a></p>
</div>
<div id="two" style="display: none;">
<h1>Page two</h1>
<p><a href="pageThree.xhtml">Go to page three</a></p>
</div>
第一页
第二页
与
函数showPageTwo(){
document.getElementById(“一”).style.display='none';
document.getElementById(“两个”).style.display='block';
}
使用JSF2.0Ajax和
rendered
属性也很容易做到这一点。不行。使用HTML/JS已经不可能了,所以JSF在这里不能为您做很多事情
最好的选择是根据一些JS/ajax条件,在pageOne.xhtml中有条件地显示pageTwo.xhtml的内容。这样,浏览器历史记录中就没有对pageTwo.xhtml的GET请求
下面是一个简单JS的基本启动示例:
<div id="one">
<h1>Page one</h1>
<p><a href="#" onclick="showPageTwo()">Go to page two</a></p>
</div>
<div id="two" style="display: none;">
<h1>Page two</h1>
<p><a href="pageThree.xhtml">Go to page three</a></p>
</div>
第一页
第二页
与
函数showPageTwo(){
document.getElementById(“一”).style.display='none';
document.getElementById(“两个”).style.display='block';
}
使用JSF2.0Ajax和
rendered
属性也很容易做到这一点。这里有一个可能的解决方案:这里有一个可能的解决方案:和