Pregunta

I want create a set of Output links similar to this

<li>
    <h:outputLink value="#" styleClass="home">Home</h:outputLink>
    <h:outputLink value="#" styleClass="home">Help</h:outputLink>
    <h:outputLink value="#" styleClass="home">About</h:outputLink>
</li>

But, the content is dynamically and i used Tomahawk library with

<t:htmlTag value="ul" binding="#{sessionBean.menu}"
                styleClass="nav navbar-nav">

            </t:htmlTag>

I the method binding i want create the set of links

public UIComponent getMenu() {
    if (menu != null) {
        menu.getChildren().clear();
        HtmlOutputLink htmlOutputLink = new HtmlOutputLink();
        htmlOutputLink.setValue("#");
        //htmlOutputLink.set   //how to set the body link
        menu.getChildren().add(htmlOutputLink);

But I do not know how to set the body of link, what is the best way to set a body link o HTMLOutputLink commonent?

¿Fue útil?

Solución

Try to add:

HtmlOutputText yourOuput = new HtmlOutputText ();
yourOuput.setValue("home"):
htmlOutputLink.getChildren().add(yourOuput);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top