to undertake component to access properties of page where it is placed

2 views
Skip to first unread message

Viorel Cojocaru

unread,
Feb 20, 2015, 9:20:13 AM2/20/15
to tapestry...@googlegroups.com
Hello everyone
can smb to help me, if it is posible.
I am new in Tapestry and I have problem with one component:
 any ideia , solution?

how to make in my page where is includet MyComponent to be accesed from mypage.properties "message-Hello=Hello world" not from it or global properties file.
Thanks

my page tml:

<t:border xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<body>

    <t:form t:id="loginForm">
<t:errors/>
        <table>
            <tr>
                <td><t:label t:for="userName">
                </t:label>:</td>
                <td><input type="text" t:id="userName" t:type="TextField"
                    t:label="message:user-name" t:value="userName"  t:validate="required" /></td>
           ......
            </tr>
        </table>

    </t:form>   
    <t:MyComponent />
 
    
  
</body>
</t:border>

component tml:

<html t:type="layout" xmlns:t="http://tapestry.apache.org/schema/
tapestry_5_3.xsd">
 
 ${newMessage }
</html>

java:
public class MyComponent {
    @Inject
    private Messages messages;
   
    public String getNewMessage(){      
       
         return messages.get("message-Hello");
    }  
}


Reply all
Reply to author
Forward
0 new messages