Re: Can freemarker use OGNL null value handling?

2007-07-07 Thread Fred Toth

Thanks. That was it! I must have been through the doc a dozen times, but I
missed the '$' vs '%' issue.

Thanks again.

Fred

Dale Newfield wrote:

Fred Toth wrote:

To be more specific: In jsp, you can do this:



This works even when user doesn't exist because of the OGNL null 
value handling.


If you use ${}, you're not using ognl, but rather el.

Try replacing your $'s with %'s.

-Dale

-
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]



Re: Can freemarker use OGNL null value handling?

2007-07-07 Thread Dale Newfield

Fred Toth wrote:

To be more specific: In jsp, you can do this:



This works even when user doesn't exist because of the OGNL null value 
handling.


If you use ${}, you're not using ognl, but rather el.

Try replacing your $'s with %'s.

-Dale

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can freemarker use OGNL null value handling?

2007-07-07 Thread Musachy Barroso

If I'm not wrong (big if there :) ), that ${user.firstName} is evaluated as
a FreeMarker expression (not a JSTL one), and FreeMarker is sensitive about
nulls:

http://freemarker.sourceforge.net/docs/app_faq.html#faq_picky_about_missing_vars

either use %{user.firstName}, or FreeMarker null operators:

http://freemarker.sourceforge.net/docs/dgui_template_exp.html#dgui_template_exp_missing

musachy

On 7/7/07, Fred Toth <[EMAIL PROTECTED]> wrote:


Hi,

I'm a big fan of struts2 and freemarker, but I'm just now getting around
to using
the struts2 UI tags in freemarker.

It appears that "automatic null value handling" feature of struts2 is
not available from freemarker?

To be more specific: In jsp, you can do this:



This works even when user doesn't exist because of the OGNL null value
handling.
OGNL discovers that user is null and creates a new user. Likewise for
firstName.

However, the same tag in freemarker does not work:

<@s:textfield name="user.firstName" value="${user.firstName}"/>

We get an exception "user is undefined". This is presumably because the
freemarker
expression language is being used, and not OGNL?

So I'm amazed that I have not been able to find a single mention of this
very important issue!

Am I missing a simple work-around?

Can anyone comment?

Thanks,

Fred Toth



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
"Hey you! Would you help me to carry the stone?" Pink Floyd


Can freemarker use OGNL null value handling?

2007-07-07 Thread Fred Toth

Hi,

I'm a big fan of struts2 and freemarker, but I'm just now getting around 
to using

the struts2 UI tags in freemarker.

It appears that "automatic null value handling" feature of struts2 is 
not available from freemarker?


To be more specific: In jsp, you can do this:



This works even when user doesn't exist because of the OGNL null value 
handling.
OGNL discovers that user is null and creates a new user. Likewise for 
firstName.


However, the same tag in freemarker does not work:

<@s:textfield name="user.firstName" value="${user.firstName}"/>

We get an exception "user is undefined". This is presumably because the 
freemarker

expression language is being used, and not OGNL?

So I'm amazed that I have not been able to find a single mention of this 
very important issue!


Am I missing a simple work-around?

Can anyone comment?

Thanks,

Fred Toth



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]