PrimeFaces 3.5를 사용 중이며 부분 페이지 렌더링에 문제가 있습니다. Facelet 파일의 내용을 템플릿의 "동적"부분에로드해야합니다. 얼굴 리디렉션을 통한 부분 페이지 렌더링 (PPR)
index.xhtml
<f:view>
<h:form id="form1">
<p:outputPanel layout="block">
<p:commandButton action="content-2?faces-redirect=false" update="display" />
</p:outputPanel>
<p:outputPanel id="display" layout="block">
content 1
</p:outputPanel>
</h:form>
</f:view>
content-2.xhtml
: 나는 <p:commandButton>
클릭하면
<h:body>
content 2 loaded
</h:body>
, 다음 content-2.xhtml
가 열립니다. 그러나 이것은 전체 페이지를 새로 고칩니다. XML 응답은 다음과 같이 포함되어 예상대로
<f:view>
<h:form id="form1">
<p:outputPanel layout="block">
<p:commandButton action="#{myBean.increment}" update="display" />
</p:outputPanel>
<p:outputPanel id="display" layout="block">
#{myBean.count}
</p:outputPanel>
</h:form>
</f:view>
그런 다음 display
블록 업데이트 :
<partial-response><changes><update id="javax.faces.ViewRoot">
나는 방법의 표현에 action
속성을 변경합니다. XML 응답은 다음과 같이 포함
<partial-response><changes><update id="form:display">
왜 action="content-2?faces-redirect=false"
방법은 전체 페이지를 업데이트합니까?
나는 또한 <ui:composition>
을 시도했지만,이 경우 템플릿의 "정적"부분을 다시로드합니다. 나는 그것을 원하지 않는다. 당신이 action
속성에 비 null
결과를 제공하여 다른보기로를 탐색 경우
'# {myBean.method}'가'content-2.xhtml'을 반환한다는 것을 의미합니까? 'faces-redirect = false'가 이미 기본값입니다. 왜 당신이 이것을 명시 적으로 언급하고 있는지 이해할 수 없습니다. 'action = "content-2.xhtml"이 다르게 행동 함을 의미합니까? – BalusC
아니요, 죄송합니다. # {myBean.method} (으)로 업데이트 된 부분을 업데이트했습니다. 메소드 본문은'count ++'처럼 보입니다. 그리고'action = "content-2.xhtml"'그것도 새로 고침'javax.faces.ViewRoot'을 시도하지만'action = "# {myBean.increment}"'refresh'display'. 나는'faces-redirect = false'가'true' 또는'false'를 할당해야한다고 생각했습니다. – Mrusful