Url JSF2.0带参数重定向
我有JavaEE应用程序,我有文章管理。有像Url JSF2.0带参数重定向,url,jsf,redirect,jsf-2,Url,Jsf,Redirect,Jsf 2,我有JavaEE应用程序,我有文章管理。有像http://localhost:8080/articles/detail.xhtml?article=70其中article表示物品的id。此页面显示文章评论等。这并不重要。但有按钮编辑,我想在page Edit.xhtml上重定向,但用户仍然应该看到http://localhost:8080/articles/detail.xhtml?article=70,因为我不希望编辑页面可以添加书签 你能帮我设置faces配置来改变页面而不是url吗?我以为
http://localhost:8080/articles/detail.xhtml?article=70
其中article表示物品的id。此页面显示文章评论等。这并不重要。但有按钮编辑,我想在page Edit.xhtml上重定向,但用户仍然应该看到http://localhost:8080/articles/detail.xhtml?article=70
,因为我不希望编辑页面可以添加书签
你能帮我设置faces配置来改变页面而不是url吗?我以为如果我不写
,url就会保持不变,但我错了。Url从detail.xhtml?article=70
更改为detail.xhtml
谢谢你的建议。我建议引入一些同轴电源,这样就不会触发同步请求
<h:panelGroup id="article" layout="block">
<h:panelGroup rendered="#{!bean.editmode}">
View article (can if necessary be an ui:include)
<h:form>
<h:commandButton value="Edit" action="#{bean.edit}">
<f:ajax render=":article" />
</h:commandButton>
</h:form>
</h:panelGroup>
<h:panelGroup rendered="#{bean.editmode}">
Edit article (can if necessary be an ui:include)
<h:form>
<h:commandButton value="Save" action="#{bean.save}">
<f:ajax render=":article" />
</h:commandButton>
</h:form>
</h:panelGroup>
</h:panelGroup>
private boolean editmode;
public void edit() {
this.editmode = true;
}
public void save() {
this.editmode = false;
}
public boolean isEditmode() {
return editmode;
}