Re: error with if condition
"Newman, John W" <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <D688C4D318A63D4290AA94A33E06F7D201C7ABAF3C@msxmbxnsprd14.acct.upmchs.net> |
The only time I've seen this happen, is if I confuse the [#ftl] directive and <> or [] syntax.
i.e. template1.ftl:
[#ftl]
<#if x>
X
</if>
template2.ftl:
[#if x]
X
[/#if]
Both those will process and appear to be static output, since the [#ftl] directive is used/not used incorrectly. But I don't see that here and that doesn't explain the ${} not interpolating, so it's probably an app config issue..
-----Original Message-----
From: Daniel Dekany [mailto:[email protected]]
Sent: Friday, June 26, 2009 9:17 AM
To: far4ever
Cc: [email protected]
Subject: Re: [FreeMarker-user] error with if condition
Friday, June 26, 2009, 1:33:34 PM, far4ever wrote:
>
> hi,
> am using FreeMarker with spring
> in the login page i have a code spinet as follows..
>
> <#if Parameters.login_error?? >
> Your login attempt was not successful, try again.<br/><br/>
> Reason:
> ${Parameters.login_error}
> </#if>
> ..
> where i want the error message on login failure to be printed
Looks OK so far.
> but on the browser what i get is as follows
> ........
> <#if Parameters.login_error?? > Your login attempt was not successful, try
> again.
>
> Reason: ${Parameters.login_error}
Umm... you get that in the *browser*? The browser should never ever
receive FreeMarker tags and interpolations, as those should be
resolved on the server.
> ......
> where the if condition is not being interpreted properly.
> and i tried as :
> <#if Parameters.login_error?exists>
>
> in both the case the condition gets printed as it is there in the ftl page
> but with out the closing tag of the if close.
> other content in the page is being shown properly and also the functionality
> (login function) is also working
>
> can anyone help me 2 figure out what has gone wrong..
If the output indeed contains ${...} stuff, then the templates are not
processed by FreeMarker at all, but are served like static files. That
means, there is something wrong with the your HTTP server or
Servelet-related setup. What URL do you enter into the browser? You
shouldn't ever visit .ftl-s directly, as they need something that
prepares the data-model, this being an MVC template engine. If you are
using JSP-Model-2-like setup, please see:
http://freemarker.org/docs/pgui_misc_servlet.html
> thanks in advance.
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
------------------------------------------------------------------------------