package tapestry.pages; public class showpage { @Component private Info Info; } --- package tapestry.components; public class Info { @Inject private Request request; private String description="some text"; public String getDescription() { return description; }
} ---- showpage.tml <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <body> <t:Info>${description}</t:Info> <!--doesn't work..how do i call component function or access variable--> </body> </html> offcourse using ${ComponentDescription} by defining getComponentDescription() is one way out :) i need to read more about @Environtment service..thnx ! Piero Sartini-3 wrote: > >> actually, it is not defined in the page class > > Seems like you need to provide more information for us to understand your > issue. > >> in my showpage class i use >> >> @Component >> private Info Info; >> >> so it still gives error saying >> tapestry.pages.showpage does not contain a property named 'description' > > Lets assume your Info component has a public property called description. > Is > this correct? > > In your page you use this component with <t:info/> and the @Component > annotation. > > Now you want access to a public property of info within the page. Never > did > something like this, but I would guess that you need to do something like > this > in your page class: > > public String getComponentDescription() { > return info.getDescription(); > } > > That said, normally you want to use @Environmental inside your components > for > communication with your enclosing components (and pages). > > Piero > >> >> Piero Sartini-3 wrote: >> >> >> secondly i have a component Info with a variable say "private >> String >> >> >> description" >> >> >> and function >> >> >> public String getDescription() { >> >> >> return description; >> >> >> } >> >> >> >> >> >> how can i use it in template ?? >> >> >> ${component:Info.description} doesnt work ! >> > >> > Just use ${description} in the template file of the component. >> > >> > Piero >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/Return-HTML-tp24154619p24156413.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org