2013-03-26 4 views
1

URL 매개 변수로 id를 사용하는 페이지가 있는데이 페이지를 사용하여 객체를 가져 와서 데이터를 표시합니다. 이 페이지에는 파일 업로드 구성 요소가 포함 된 모달이 있으므로 저장을 처리하는 데 아약스를 사용할 수 없습니다. 대신 우리는 이렇게 :<h : commandButton>을 클릭하면 url 매개 변수가 유지됩니다.

<rich:modalPanel domElementAttachment="parent" id="profilePanel" styleClass="popUp" resizeable="false" moveable="false" autosized="true" zindex="200" top="-10"> 
     <a4j:form enctype="multipart/form-data" id="profilePanelFormId"> 
      <q:box title="Edit Advocacy Profile" width="width6x" wantFocus="true"> 
       <s:div id="profilePanelForm"> 
        <rich:messages rendered="#{messagesUtil.errorsExist}"/> 
        <a4j:include viewId="/panel/advocacy/advocateProfileEdit.xhtml"/> 
       </s:div> 
       <h:commandButton id="cancel" immediate="true" value="Cancel" action="#{advocateManager.cancelEditCommitment}" styleClass="button cancel" tabindex="100"/> 
       <h:commandButton id="save" value="Save" action="#{advocateManager.saveCommitment}" styleClass="submit" tabindex="101"/> 
      </q:box> 
     </a4j:form> 
    </rich:modalPanel> 

우리는과 같이 pages.xml에서 매개 변수를 채울 :

<page view-id="/advocacy/advocateCommitmentView.xhtml" login-required="true"> 
    <param name="confirmationCode" value="#{advocateManager.commitmentId}"/> 
</page> 

를 지금까지 너무 좋아. 우리가 실행하고있는 문제는 사용자가 필요한 id 매개 변수없이 url을 다시 작성하거나 취소 할 때 발생합니다. 그런 다음 사용자가 페이지를 새로 고치면이 키가 없기 때문에 오류가 발생합니다. 아무도 아약스를 사용하지 않고 내 저장 메서드를 호출 할 수 있고 여전히 url 매개 변수를 유지하거나 호출을 가로 채고 매개 변수를 다시 추가하는 방법을 알고 있습니까?

답변

0

동작 문자열의 끝에 ?includeViewParams=true을 넣습니다.

0

<h:commandButton/>은 양식을 게시하고 양식 게시는 URL에 매개 변수를 포함하지 않기 때문에 이런 일이 발생합니다. 매개 변수를 추가하려면, 같은 페이지로 리디렉션 네비게이션 규칙 만들기 : 리디렉션을 수행 할 때

<navigation from-action="#{advocateManager.saveCommitment}"> 
    <rule> 
     <redirect view-id="/same-page.xhtml" /> 
    </rule> 
</navigation> 

를 페이지의 매개 변수를 인코딩하고 URL에 추가됩니다. 리디렉션이 완료되면 #{advocateManager.commitmentId}이 채워져 있어야합니다.

관련 문제