Hi,

First you have to create the tree data (see getTreeData() method from
the examples) passing an extra parameter to the TreeNodeBase
constructor, in order to give each node an identifier (I have given
the page to navigate to, for example).

Then, indicate in the action of the commandLink component the following:

        <f:facet name="document">
                <x:panelGroup>
                        <x:commandLink immediate="true" 
action="#{myBean.menuAction}">
                                <h:graphicImage value="images/document.png" 
border="0" />
                                <x:outputText value="#{node.description}" />
                                <f:param name="action" 
value="#{node.identifier}" />
                        </x:commandLink>
                </x:panelGroup>
        </f:facet>

As you can see, you will have to define a method in your "myBean" bean
in order to be able to execute the action:

public String menuAction()
{
                return (String) 
FacesContext.getCurrentInstance().getExternalContext()
                                .getRequestParameterMap().get("action");
}

Notice that you ask for a request parameter named "action", which must
match the name of the param you provided in the JSP view.

In my case, this method returns the identifier of the node clicked,
which is the page to go in the navigation model.

You will only have to provide different logic to that method.

Hope it helps,
Enrique Medina.

On 4/25/05, Mihir Solanki <[EMAIL PROTECTED]> wrote:
>  
>  
> 
> Hi, 
> 
>   
> 
> I am using tree2 component. 
> 
>   
> 
> I have a kind of windows explorer UI, where in my tree nodes are formed with
> folders, sub-folders and files. 
> 
> For the same I have three different facets like "folder", "sub-folder" and
> "document" in my tree2 component. 
> 
>   
> 
> Now what I want to have is, whenever "document" type node is clicked I have
> to open that particular document in my browser window. 
> 
> For that I guess I need to submit my action to the HttpServlet which reads
> the file data and opens in the browser window (by putting file data in the
> Servlet stream). 
> 
>   
> 
> Can anybody tell me how can I submit the click action of any tree node to
> HttpServlet? 
> 
> Or is there any other way to achieve the above kind of functionality? 
> 
>   
> 
> Thanks 
> 
> Mihir Solanki 
>  ________________________________
>  
>  
> 
> Patni Computer Systems Ltd. 
>  
> 
> Tel : 91 79 23240905 Ext : 413 
> 
>   
> http://www.patni.com
>  World-Wide Partnerships. World-Class Solutions. 
> _____________________________________________________________________
>  
>  This e-mail message may contain proprietary, confidential or legally
> privileged information for the sole use of the person or entity to whom this
> message was originally addressed. Any review, e-transmission dissemination
> or other use of or taking of any action in reliance upon this information by
> persons or entities other than the intended recipient is prohibited. If you
> have received this e-mail in error kindly delete this e-mail from your
> records. If it appears that this mail has been forwarded to you without
> proper authority, please notify us immediately at [EMAIL PROTECTED] and
> delete this mail. 
> _____________________________________________________________________

Reply via email to