users@glassfish.java.net

creating customCommandLink

From: freepal <am05011996_at_hotmail.com>
Date: Mon, 24 Sep 2007 18:36:51 -0700 (PDT)

Hí ,

my customComponentClass :

public class UIComponent extends UIComponentBase
        {
                
                

                public void encodeBegin(FacesContext context) throws IOException
                {
                        
                       ....
                       ....
                       ....
                         writer.write("<table border=\"1\"
cellspacing=\"0\" cellpadding=\"0\" >");
                    writer.write("<tr><td>");
                    writer.write(" \"images/treenode.gif\" ");
                    writer.write("<td colspan=\"2\">");


                  ------> HERE (commandLink)
                  

                    writer.write("</td>");
                    writer.write("<td></td>");
                    writer.write("<td></td>");
                    writer.write("<td></td>");
                    writer.write("</tr>");
                         writer.write("</table>");
                          ...


                     }
what i am trying to do is to create a HTMLTable and inside it i want a
CommandLink like normaly in a JSP Page , also something like :

<h:form id="selectedOrderForm">
 
 
 <h:commandLink id="selectFactory"
                   action="orderingFactory"
                   actionListener="#{selectionBean.initSelection}"
                   style="border:0;">
                                  
<h:graphicImage value="images/orderingButtonbg.jpg" style="border:0;"/>
                                 
 <f:param id="selectedId"
         name="gebotId"
         value="666666" />
</h:commandLink>
 
 </h:form>


how should i do this inside my CustomComponent implementation , if i write
it easy in writer.write(...) , my browser do not understand it as a
commandlink and donot compile it.
how can i get back a working commandlink .
i know that i can place so such thing directly in the JSP-page, but i don't
want this. i want that my costomComponent place this inside its output
(CommandLink inside a Table).

i tried to use this (but donot know how to use it exactly so that it works):

HtmlCommandLink cl = (HtmlCommandLink)context.getApplication()
                     .createComponent(HtmlCommandLink.COMPONENT_TYPE);
                         MethodBinding mbActionListener =
context.getApplication().createMethodBinding("#{backingBean.myAction}", new
Class[] {javax.faces.event.ActionEvent.class });

                         cl.setActionListener(mbActionListener);
                         cl.setTransient(true);
                         cl.setValue("click me");


but THEN where should i use it or how to use my created HtmlCommandLink how
can i print it out or how to use it inside the table :( i need some help
please :-(

many thanks
-- 
View this message in context: http://www.nabble.com/creating-customCommandLink-tf4512826.html#a12871648
Sent from the java.net - glassfish users mailing list archive at Nabble.com.