Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Url JSF2.0带参数重定向_Url_Jsf_Redirect_Jsf 2 - Fatal编程技术网

Url JSF2.0带参数重定向

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吗?我以为

我有JavaEE应用程序,我有文章管理。有像
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;
}