I am trying to load some data in a p:dialog but I get "Cannot set content type. Response already committed" error and the data in dialog is not displayed.. also the "selectedGift" value is always null ..

Here is my xhtml .. any ideas?

    <h:form id="giftForm">

        <p:dataGrid var="gift" value="#{AvailableGiftsView.gifts.giftType}" columns="3"  
    rows="12" >  

    <p:panel header="#{gift.nameAr}" style="text-align:center">  
        <h:panelGrid columns="1" style="width:100%">  


            <h:outputText value="#{gift.descriptionAr}" />  
            <p:commandLink  update=":giftForm:giftDetail" onclick="giftDialog.show()" title="View Detail">  
                <p:graphicImage value="#{gift.photoUrl}"/>   
                <f:setPropertyActionListener value="#{gift}"   
                        target="#{AvailableGiftsView.selectedGift}" />  
            </p:commandLink>  

        </h:panelGrid>  
    </p:panel>  

</p:dataGrid>  

 <p:dialog id="dlg" header="Gift Detail" widgetVar="giftDialog" modal="true">  
    <h:outputText value="Resistance to PrimeFaces is futile!" />  
    <p:outputPanel id="giftDetail" style="text-align:center;"> 
     <h:panelGrid  columns="2" cellpadding="5">  
            <h:outputLabel for="giftName" value="Gift Name " />  
            <h:outputText id="giftName" value="#{AvailableGiftsView.selectedGift.name}" />  

            <h:outputLabel for="costPoints" value="Points: " />  
            <h:outputText id="costPoints" value="#{AvailableGiftsView.selectedGift.pointsCost}" />  

            <h:outputLabel for="description" value="Description: " />  
            <h:outputText id="description" value="#{AvailableGiftsView.selectedGift.name}"/>  
        </h:panelGrid> 
    </p:outputPanel> 
</p:dialog>  
    </h:form>

</f:view>
</h:body>
有帮助吗?

解决方案

Well, after nearly 4 days I found out what's the problem .. the thing is I am using RAD 8.5 and Websphere portal 8.0 .. while creating my portlet it was created on JSR 168 so the portlet.xml was as follow

http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" id="com.ibm.faces.portlet.FacesPortlet.2a8361a544">

as you can see it uses schema version 1.0

while when I changed it to be

http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" id="com.ibm.faces.portlet.FacesPortlet.2a8361a544">

it worked perfectly fine !

I hope it helps someone out there .. the whole problem was portlet version not compatible with AJAX kind of requests ...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top