2 Replies Latest reply on Jul 24, 2009 10:22 AM by iimirela

    rich:tree meets iframe

    iimirela

      ...and they hate each other!!! :)

      Seriously .. help!!

      I have

      <rich:tree id="tree" width="400px" value="#{Bean.tree}"
       var="node" ajaxSubmitSelection="true" switchType="client"
       nodeSelectListener="#{Bean.processTreeNodeImplSelection}"
       toggleOnClick="true" reRender="panel">
       <rich:treeNode>
       <h:outputText value="#{node.descrizione}" />
       </rich:treeNode>
      </rich:tree>
      <a4j:outputPanel id="panel">
      <f:verbatim>
       <iframe src="#{Bean.pdf}" width="680" height="480">
       </iframe>
      </f:verbatim>
      </a4j:outputPanel>
      


      Im the backing bean, I set pdf's value, which is a url where a servlet (from another context) responds with a pdf.

      clicking on the tree node does nothing.. in the html source, the iframe has src="", but on refreshing the page however, the pdf is rendered.

      HELP!!! It's driving me crazy.

      Here's also my listener:
      public void processTreeNodeImplSelection(final NodeSelectedEvent event) throws IOException{
       HtmlTree tree = (HtmlTree) event.getComponent();
       //nodeTitle = (Object) tree.getRowData();
       TreeNode<Object> currentNode = tree.getModelTreeNode(tree.getRowKey());
       if (currentNode.isLeaf()){
       ...
       javax.faces.context.ExternalContext ext = FacesContext.getCurrentInstance().getExternalContext();
       HttpServletRequest request = (HttpServletRequest)ext.getRequest();
      
       String host = request.getRemoteHost();
       int port = request.getServerPort();
      
      
      
       pdf ="http://"+host+":"+port+"/otherContext/createpdf";
       }
      


      Ioana.