Re: tiles as attribute's value - is it possible ?
Hello, If you have access to the html:mytag ... code, you can modify it to take the tiles' attribute name as attribute, and retrieve the corresponding value from TilesContext. Check how tiles:getAsString is implemented for examples (class GetAttributeTag.java). If you don't want some Tiles code in your tag, use the classic tag way of life : modify your tag to take the attribute name as input, and retrieve the value from the page context. Before using your tag, put the requested tiles' attribute in page context : tiles:importAtribute name=title / !-- put tiles attribute in page context -- html:mytag name=title/ !-- retrieve attribute from page context -- Hope this help, Cedric Arik Levin ( Tikal ) wrote: Hi all. I have some tag which I want it to be like this: html:mytag value=tiles:getAsString name=title / / As I saw after some searching I saw that some of you out there did it like this: tiles:useAttribute name=title classname=java.lang.String ignore=true/ html:mytag value=%=title%/ Did somebody has manage to come up with a cleaner idea? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: tiles as attribute's value - is it possible ?
Tikal I do this tiles:useAttribute id=titleKey name=title/ titlebean:message name=titleKey scope=page//title This allows for I18N by using a tiles def for the title key and the ApplicationResources file for the text. This is the definition: definition name=home.pagedef extends=layouts.pagedef put name=title value=home.title / put name=headervalue=/web/includes/header.jsp / put name=index value=/web/pages/home/HomeIndex.jsp / put name=indexMain value=/web/includes/index.jsp / put name=content value=/web/pages/home/HomeContent.jsp / put name=footer value=/web/includes/footer.jsp / put name=styleSheet value=web/styles/Grey_StyleSheet.css / put name=keywords value=home.keywords/ put name=crumbsvalue=/web/includes/crumb.jsp/ put name=crumbtitle1 value=Home/ put name=crumblink1value=/home/home/ put name=pagename value=home/ /definition and in the applicationResources file: home.title=Cal and VA | Home Cal http://www.calandva.com/Last update 06/30/02 -Original Message- From: Arik Levin ( Tikal ) [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 11, 2002 13:33 To: Struts Users Mailing List Subject: tiles as attribute's value - is it possible ? Hi all. I have some tag which I want it to be like this: html:mytag value=tiles:getAsString name=title / / As I saw after some searching I saw that some of you out there did it like this: tiles:useAttribute name=title classname=java.lang.String ignore=true/ html:mytag value=%=title%/ Did somebody has manage to come up with a cleaner idea? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
tiles as attribute's value - is it possible ?
Hi all. I have some tag which I want it to be like this: html:mytag value=tiles:getAsString name=title / / As I saw after some searching I saw that some of you out there did it like this: tiles:useAttribute name=title classname=java.lang.String ignore=true/ html:mytag value=%=title%/ Did somebody has manage to come up with a cleaner idea?
RE: tiles as attribute's value - is it possible ?
If html:mytag is really your own tag, then you could modify it to alternatively take its value from the body, so you could use it like this: html:mytag tiles:getAsString name=title/ /html:mytag If you still need to be able to use the 'value' attribute in other situations, then you could have the tag look for the 'value' attribute, and only use the body if the attribute is not present. -- Martin Cooper -Original Message- From: Arik Levin ( Tikal ) [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 11, 2002 10:33 AM To: Struts Users Mailing List Subject: tiles as attribute's value - is it possible ? Hi all. I have some tag which I want it to be like this: html:mytag value=tiles:getAsString name=title / / As I saw after some searching I saw that some of you out there did it like this: tiles:useAttribute name=title classname=java.lang.String ignore=true/ html:mytag value=%=title%/ Did somebody has manage to come up with a cleaner idea? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]