org.chenillekit.tapestry.core.components.Element

Helper component that will render a variable element type. Similar to the Any component in Tapestry3.

[JavaDoc]

Component Parameters

Name Type Flags Default Default Prefix Description
clientId String NOT Allow Null prop:componentResources.id literal The id used to generate a page-unique client-side identifier for the component. If a component renders multiple times, a suffix will be appended to the to id to ensure uniqueness.
elementName String NOT Allow Null prop:componentResources.elementName literal The element to render. If not null, then the component will render the indicated element around its body. The default is derived from the component template.

Informal parameters: supported

Examples

This example describe how to use the Element component.

this component is deprecated, please use the Any component since Tapestry 5.0.12

MyPage.tml

                    
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    <body>
        <h1>Hello Guys and Dolls</h1>

            <ul>
                <li t:type="ck/Element">
                    list element 1
                </li>

                <div t:type="ck/Element" elementName="li">
                    list element 2
                </div>

                <li t:id="liElement">
                    list element 3
                </li>
            </ul>

            <div t:type="ck/Element" elementName="hr"/>

            last mouse over event received from : <span style="font-weight:bold;" id="onMouseOverResult">&nbsp;</span>

            <script type="text/javascript">
                function onMouseOver(response)
                {
                    $('onMouseOverResult').innerHTML = response;
                }
            </script>

    </body>
</html>

                

MyPage.java

                    
public class MyPage
{
    @Component(parameters = {"elementName=li", "event=mouseover", "onCompleteCallback=onMouseOver"})
    @Mixins("ck/OnEvent")
    private Element _liElement;

    @OnEvent(component = "liElement", value = "mouseover")
    public StreamResponse onMouseOver()
    {
        return new TextStreamResponse("text/html", new Date().toString());
    }
}

                

Back to index