2010-11-19 7 views
0

I 내 ​​Java EE 애플리케이션 기사 관리가 있습니다. 상품이 상품의 ID를 의미하는 http://localhost:8080/articles/detail.xhtml?article=70과 같은 URL이 있습니다. 이 페이지는 기사 주석 등을 표시하며 중요하지 않습니다. 버튼 편집이 있고 edit.xhtml 페이지로 리디렉션하고 싶지만 사용자가 여전히 http://localhost:8080/articles/detail.xhtml?article=70으로 표시되어야합니다. 편집 페이지를 북마크 할 수 없기를 원하기 때문입니다.매개 변수가있는 JSF 2.0 리디렉션

페이지가 변경되지만 URL은 변경되지 않도록 faces-config를 설정하는 방법을 알려주십시오. 나는 내가 <redirect />을 쓰지 않으면 URL이 똑같이 유지 될 것이라고 생각했지만 틀렸다. URL이 detail.xhtml?article=70에서 detail.xhtml

주셔서 감사합니다.

답변

2

동기 요청이 발생하지 않도록 일부 능력을 가져와야합니다.

<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; 
} 
+0

가능하다면, http://stackoverflow.com/questions/4231206를 살펴 보자 –