2 Replies Latest reply on Nov 3, 2010 8:37 AM by nuwanr

    calling actions from a pop-up window

    nuwanr
      Hi All,
      I am having a problem calling action method with a pop-up windows.
      This is the scenario.

      I open a pop-up window with s:link as below

                           <s:link propagation="join"
                              onclick="window.open('/showbitz/page/production-prop-brief.page?propBriefId='+#{_propBrief.id},'Prop Brief','menubar=1,resizable=1,width=950,height=900, scrollbars=1, status=1');"
                              id="viewProductionPropBriefEdit" value="#{_propBrief.name}"
                              action="#{editPropBrief.viewInPopUp()}" />

      Here production-prop-brief.xhtml has some action buttons. When I perform that actions it throws this exception

      javax.servlet.ServletException: /page/production-prop-brief.xhtml @146,115 value="#{editPropBrief.propBrief.brief}": Target Unreachable, 'propBrief' returned null on 'com.productiongenie.showbitz.action.EditPropBriefAction_$$_javassist_seam_10'
           javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
           org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
           org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
           org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
           org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


      I think the problem is that the pop-up window cant hold its context.
      IF anybody have experience with performing action methods with a pop-up window please help me with this.

      Thanks

        • 1. Re: calling actions from a pop-up window
          lvdberg

          Hi,


          You must have an active conversation (or - not preferred - have everything in session scope) to have the beans in context. So at the moment you open your modalpanel without having the bean in scope, which results in a null-pointer error.


          Add a begin annotation (if needed nested) on the viewInpopup() method.


          The other thing is that you're NOT using a ajax-type link which which is also not adviceable. Change it to a Ajax-version link and use the oncomplete method to open the modalpanel.Additionally use the reRender attribute of that ajax-link to reRender the content of you modal panel.



          Leo

          • 2. Re: calling actions from a pop-up window
            nuwanr

            Hi,
            Thanks for the response Leo.
            For the moment what I did was change the requirement to open it as a new tab instead of new window(Hoping client may not disagree with that.). That way works fine.
            If in case a pop-up would be requested I will try the things you have specified.


            Thanks.