2017-08-30 82 views
2

讓我們假設我有下一個圖形圖像標籤的形式重新渲染的<h:graphicImage的由<P:的commandButton

<p:lightBox styleClass="imagebox " id="imageLightBox" rendered="true"> 
    <h:outputLink value="http://..../center/#{myBean.centerId}/picture" title="Bla bla bla"> 
     <h:graphicImage value="http://..../center/#{myBean.centerId}/picture" /> 
    </h:outputLink> 
</p:lightBox> 

內部和我有下一個primefaces命令按鈕

<p:commandButton icon="fa fa-save" value="Save" title="Save" actionListener="#{myBean.saveCenterImage()}" update="@form" > 

因此,如何能我重新渲染graphicImage當我點擊commandButton

+0

如果你正在更新表單,它應該實際上被重新渲染,很可能你錯過了process =「imageLightBox」或process =「@form」。順便說一句,我會刪除呈現的屬性,因爲它始終是真的(除非它只是爲了清晰起見),請參閱https://stackoverflow.com/questions/9010734/why-do-i-need-to-nest-a -component-with-rendered-some-in-another-component-w/ –

+0

@MárioFernandes:進程屬性用於在服務器上處理關於提交的值的內容。你仍然可以更新**未處理的東西。 – Kukeltje

+0

你調試了什麼?你檢查了ajax響應嗎?它包含什麼?相同或新的網址?瀏覽器試圖檢索它嗎?導致304?請解釋更多 – Kukeltje

回答

3

我認爲您需要使用p:graphicImage而不是h:graphicImage,並設置屬性cache = false,以便瀏覽器不會緩存圖像。

相關問題