Re: How to use JSP tags icluded in a freemarker template available in the final rendered page
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
It should work with #include, so I suspect that the problem has
nothing to do with that. Or does it work if you just copy-paste the
content of jspTags.ftl into the place of the #include? (If so, you may
#include another file than you think you are including.)
Wednesday, November 18, 2009, 1:57:56 PM, quophyie wrote:
> Hi All
>
> I am having a few problems with importing jsp tags into my freemarker
> templates and i was hoping someone could help.
>
> The problem is this. I have a freemarker file which defines a few jsp
> taglibs which I would like imported into all my jsp files. My jsp tags are
> defined in a file called jspTags.flt as defined below
>
> jspTags.ftl
>
> <#assign c=JspTaglibs["http://java.sun.com/jsp/jstl/core"]>
> <#assign fmt=JspTaglibs["http://java.sun.com/jsp/jstl/fmt"]>
> <#assign form=JspTaglibs["http://www.springframework.org/tags/form"]>
>
> I have then defined my freemarker template as follows
>
> freemarkerTemplate.ftl
>
> <#include "jspTags.ftl">
> <html>
> <head>
> <title>My Site - {title}</title>
> </head>
> <body bgcolor="#FFFFFF">
> <h1>My freemarker template </h1>
> {body}
> </body>
> </html>
>
>
> Now I want to apply the template to a JSP page as defined below
>
> login.jsp
>
> <html>
> <head>
> <title>Login</title>
> </head>
> <body bgcolor="#FFFFFF">
> <@form.form action="loginAction.jsp" method="POST">
> <table border="1">
> <tr>
> <td>
> My Login Page!!!
> </td>
> </tr>
> </table>
> </@form.form>
> </body>
> </html>
>
>
> However, I when I try and access the page (login.jsp), I get an error like
>
> Expression form is undefined on line 14, column 3 in view/login.jsp.
> The problematic instruction:
> ----------
==>> user-directive form.form [on line 14, column 1 in view/login.jsp]
>
> So my question is, If I have my jsp tags defined in one file(jspTags.ftl)
> and include it my template(freemarkerTemplate.ftl), how do I make the
> jsp tags available in the view(login.jsp) that the template is being applied
> to.
>
> Any help will be very much appreciated.
>
> Thanks
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july