By the way, we do the exact same type of thing in Trails. The PropertyDescriptor class returns a "displayName". However, I don't like how we implemented it. Right now it uses AspectJ to override that.
-----Original Message----- From: James Carman [mailto:[EMAIL PROTECTED] Sent: Thursday, March 02, 2006 9:27 AM To: 'Tapestry users' Subject: RE: Setting an OGNL variable Instead of having the PageObject return you its name, why not have it return you it's message key, so you can look up its name? -----Original Message----- From: Greg Cormier [mailto:[EMAIL PROTECTED] Sent: Thursday, March 02, 2006 9:25 AM To: Tapestry users Subject: RE: Setting an OGNL variable I would but I don't see how. aPage is a POJO (a class PageObject) Ideally, PageObject would have String getName() { if (getLocale() == ...) return getNameA(); else if (...) return getNameB(); } However, it has no access to the engine or pages locale. I'm open to suggestions. I thought of putting a constructor in PageObject to pass in the locale, but the thing is, it's created once, regardless of the language. Having it created for each language would be useless. So, I need a way to get this POJO to be able to access the engine's locale somehow, or, I need to work around it myself. Greg -----Original Message----- From: James Carman [mailto:[EMAIL PROTECTED] Sent: Thursday, March 02, 2006 9:19 AM To: 'Tapestry users' Subject: RE: Setting an OGNL variable Sounds a bit convoluted to me. Why can't you use Tapestry's i18n support? -----Original Message----- From: Greg Cormier [mailto:[EMAIL PROTECTED] Sent: Thursday, March 02, 2006 9:14 AM To: Tapestry users Subject: Setting an OGNL variable Is there a way to set a variable using OGNL? Here's my situation. I'm looping over a collection, and I use a property a lot. Depending on certain conditions I output it in different ways. This is a block of code from my header HTML file : <span jwcid="@If" condition="ognl:normalItem"> <li><a jwcid="@PageLink" page="ognl:aPage.title"><span jwcid="@Insert" value="ognl:aPage.englishName" /></a> </span> <span jwcid="@If" condition="ognl:selectedItem"> <li class="clsItemSelected"><span jwcid="@Insert" value="ognl:aPage.englishName" /> </span> <span jwcid="@If" condition="ognl:aPage.noLink"> <li class="normal"><span jwcid="@Insert" value="ognl:aPage.englishName" /> </span> Now I want to add some i18n to this. So instead of using englishName, I might use frenchName. This aPage is a POJO, so I can't just call a getName() and have it call getLocale() or anything. So, what I want to do, in Pseudo code : --- if (languageA) pageName = aPage.languageA; if (languageB) pageName = aPage.languageB; if (languageC) pageName = aPage.languageC; <insert 3 spans from above, using value="ognl:pageName"> --- This might be a little confusing but hopefully someone is able to follow this :) Thanks, Greg --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
