Freemarker considers null references errors.  When
myActionProperty.subProperty is referenced in the Struts tag, it is
printed regardless of its value.  However, when Freemarker encounters
${myActionProperty.subProperty}, it will give you an error if
subProperty is null.  When trying to print Freemarker variables using
the $ or # syntax, you should probably do an if check like this:

<# if myActionProperty.subProperty?exists>
  ${myActionProperty.subProperty}
</#if>

I know, it's a bit of a pain.

Zarar Siddiqi



On 9/6/07, Kenton <[EMAIL PROTECTED]> wrote:
>
> I'm a newbie trying learn how to use FreeMarker for Struts result pages.
>
> This code works: <@s.property value="myActionProperty.subProperty" />
> This code triggers a FreeMarker error (expression undefined):
> ${myActionProperty.subProperty}
>
> Obviously, I'm missing something very simple. But what is it?
>
> Is there any way to dump the tree of EL variables so that I can undertand
> better?
>
> Is there any good documentation on using FreeMarker in Struts? I can find
> great documentation on FreeMarker by itself and Struts by itself, but I
> can't find any docs or tutorials on using the two together. Any suggestions?
> --
> View this message in context: 
> http://www.nabble.com/Simple-Question-about-FreeMarker-%2B-Struts-2-tf4394620.html#a12531237
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to