You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Leonidas Papadakis <it...@creteonline.gr> on 2007/08/28 20:07:30 UTC
struts2 freemarker session check
Hi there,
i used to have this expression : <#if Session.sessionaff?exists></#if>
in my freemarker template.
Unfortunately this does not get parsed and generates an error :
Expression Session is undefined on line ....
Can anyone tell me the new syntax please ?
Thank you very much
Leonidas
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts2 freemarker session check
Posted by Haroon Rafique <ha...@utoronto.ca>.
On Tomorrow at 12:09am, LP=>Leonidas Papadakis <it...@creteonline.gr> wrote:
LP> I will answer myself in case someone else has the same issue.
LP>
LP> I think since freemarker 2.3.1 or something if the session is not set
LP> from the servlet it is not initialized in the template. Thus a check
LP> for the Session object has to precede the check for the session
LP> property i.e. <#if Session?exists></#if>
LP>
Hi Leonidas,
I think you can accomplish what you're trying to achieve with your
original 1-liner slightly modified:
<#if (Session.sessionaff)?exists></#if>
Can you try that? The above will only return true, if Session exists and
Session.sessionaff exists.
Later,
--
Haroon Rafique
<ha...@utoronto.ca>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts2 freemarker session check
Posted by Leonidas Papadakis <it...@creteonline.gr>.
I will answer myself in case someone else has the same issue.
I think since freemarker 2.3.1 or something if the session is not set
from the servlet it is not initialized in the template. Thus a check for
the Session object has to precede the check for the session property i.e.
<#if Session?exists></#if>
Leonidas
Leonidas Papadakis wrote:
> Hi there,
>
> i used to have this expression : <#if Session.sessionaff?exists></#if>
> in my freemarker template.
> Unfortunately this does not get parsed and generates an error :
> Expression Session is undefined on line ....
>
> Can anyone tell me the new syntax please ?
>
> Thank you very much
>
> Leonidas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org