Hi Hernán
In Trails 1.2 the ObjectForm will render its body (if a form body
exists), so there is no need to add property to the model, just add
the tapestry code directly in the body of the ObjectForm and Trails
will render it.
There is no way to access the message bundle from the model, you can
access it from any spring service or from a tapestry page.
Spring example:
<bean id="descriptorInternationalizationAspect"
class="org.trails.i18n.DescriptorInternationalization"
factory-method="aspectOf">
<property name="trailsMessageSource" ref="trailsMessageSource"/>
</bean>
Tapestry example:
@InjectObject("service:trails.core.MessageSource")
TrailsMessageSource getResourceBundleMessageSource();
You can also use Tapestry's default i18n mechanism:
http://tapestry.apache.org/tapestry4.1/usersguide/localization.htmlIn the end your code could look something like this:
<form jwcid="@trails:ObjectForm" model="ognl:model">
<span jwcid="@If" condition="ognl:model != NULL AND model.SOMETHING != null">
<a href="DOWNLOAD_LINK_HERE">DOWLOAD INVOICES PDF</a>
</span><span jwcid="@Else">
<p><span key="THERE_IS_NO_PDF_MESSAGE_KEY"/></p>
</span>
</form>
Saludos.
Alejandro.
On Tue, Jan 13, 2009 at 4:48 PM, El Acuariano <
acuariano@...> wrote:
> Hi all,
> first of all, thanks Alejandro for your help last time. Haven't tried all
> your tips, had to prioritize ;) But the most important stuff I needed worked
> like a charm.
> Now I have a couple of new problems that maybe have a simpler solution:
> - I added a method to make a PDF file of an invoice. I would like to show a
> link to the PDF in the invoice description page. To do this I would add a
> pdfLink property to the Invoice class and add Edit page for the Invoice
> where I would add an edition block for the pdfLink and show the property as
> a link. Is this the recommended approach or is there a simpler way?
> - I would like to access the messages bundle from code. For example, if the
> pdfLink property above isn't set, I would like to show a localized "no PDF
> file" message instead of the property null value. Is there a standard way of
> doing this? Can I access the messages bundle in the Invoice class getPdfLink
> method and return the localized message when the field is null?
> Regards,
> Hernán
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email