Components and Menus in Tapestry

Discussions

Web tier: servlets, JSP, Web frameworks: Components and Menus in Tapestry

  1. Components and Menus in Tapestry (2 messages)

    Hello all,

    I'm currently getting started with Tapestry, building a very simple demo application that can then become a template for typical web apps.

    I want to have a template that has the general layout for the site and then have at least a component to render the menus all the time in a context dependant way.

    My problem is that the DirectLinks are specified in that Menu component, but the listener is registered to the page that is including the menu. ¿How can I pass as a parameter the listener to the menu? ¿Is possible to create a listener just for that menu, that is not associated with anypage in particular?


    Thanks for the help.

    Mario Sánchez
  2. The way I did it was:

    menu.jwc:
    <parameter name="listener" direction="auto" required="yes" type="org.apache.tapestry.IActionListener"/>

    menu.html:
    <span jwcid="@DirectLink" listener="ognl:listener">Link</span>

    Home.html:
    <span jwcid="@Menu" listener="ognl:listeners.menuSelect">
    ...

    Home.java:
    public void menuSelect(IRequestCycle cyle) {
      // ...
    }
  3. My code is given below:
        <component id="rcdDetail" type="Foreach">
            <binding name="source" expression="detaylar"/>
            <binding name="value" expression="fatDetay"/>
        </component>
    ....
    ....
    ....
        <component id="InvoiceInfo" type="DirectLink">
            <binding name="listener" expression="listeners.submitInvoiceDetails"/>
            <binding name="parameters" expression="fatDetay.name"/>
        </component>

    I want pass surname and address information with the link..
    How can I achieve that..

    Thanks