jsf - <p:commandButton> referencing <p:contentFlow var="i"> throws javax.el.PropertyNotFoundException: Target Unreachable, identifier 'i' resolved to null -
i keep getting javax.el.propertynotfoundexception: target unreachable, identifier 'i' resolved null on primefaces application, when click on commandbuttonwhich supposed delete image can't seem find reason. checked this answer nothing there problem. when remove or not click on commandbutton application works, , var="i" works other dom/pf elements, i'm stuck here. in advance.
here's code:
<h:form> <div id="visor-imagenes"> <p:contentflow value="#{imagehandler.personalimglist}" var="i" id="contentflow" styleclass="contentwrapp"> <p:graphicimage value="#{fileuploadmb.image}" styleclass="content" onclick="clickflow(this, event)"> <f:param name="id" value="#{i.id}"/> <h:inputhidden value="#{i.imagedescription}"/> <p:commandbutton icon="ui-icon-trash" action="#{imagehandler.deleteimage(i.id)}" update="contentflow"> </p:commandbutton> </p:graphicimage> <div class="caption">#{i.imagename}</div> </p:contentflow> </div> </h:form> bean:
public void deleteimage(string i) { this.imgfacade.deleteimage(i); } i tried using <f:param, <f:setpropertyactionlistener i value in commandbutton non of these worked.
setting commandbutton out of <p:graphicimage throws same error:
<p:contentflow value="#{fileuploadmb.personalimglist}" var="i" id="contentflow" styleclass="contentwrapp"> <p:commandbutton icon="ui-icon-trash" action="#{fileuploadmb.deleteimage}" update="contentflow"> <f:param name="id" value="#{i.id}"/> </p:commandbutton> <p:graphicimage value="#{fileuploadmb.image}" styleclass="content" onclick="clickflow(this, event)"> <f:param name="id" value="#{i.id}"/> <h:inputhidden value="#{i.imagedescription}"/> </p:graphicimage> <div class="caption">#{i.imagename}</div> </p:contentflow> also, have done overriding onclick event image, since default clicking redirected image file.
<script> function clickflow(item, e) { if ($(item).parent().hasclass('active')) { e.stopimmediatepropagation(); var text = $(item).siblings("input[type=hidden]").attr('value'); $('.image-linker:first-child').attr('href', $(item).attr('src')); $('.image-linker:first-child').attr('title', text); $('.image-lightboxer:first-child').attr('src', $(item).attr('src')); $('.image-linker:first-child').click(); } } </script> the <h:inputhidden value="#{i.imagedescription}" allows fill lightbox title="" attribute dinamically.
i don't think but, onclick event being overridden have effect on issue?
the <p:contentflow> not uidata component. not capable of saving , restoring iteration state during component tree visit (as required during decode of uicommand component). you'd need print image's unique identifier http request parameter during render response.
<p:commandbutton icon="ui-icon-trash" action="#{imagehandler.deleteimage}" update="contentflow"> <f:param name="id" value="#{i.id}"/> </p:commandbutton> public void deleteimage() { string = facescontext.getcurrentinstance().getexternalcontext().getrequestparametermap().get("id"); this.imgfacade.deleteimage(i); }
Comments
Post a Comment