Re: JspTagLibs - no error but tag is being ignored

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Saturday, May 31, 2008, 8:50:11 PM, doahh wrote:

> Hello,
>
> I am trying to integrate some 3rd party taglibs into a Freemarker template
> for JForum. I have added the following code to pull in the JspTaglibs
> directive:
>
> context.put(FreemarkerServlet.KEY_JSP_TAGLIBS, new
> TaglibFactory(this.getServletContext()));  
> DefaultObjectWrapper wrapper = new DefaultObjectWrapper();  
> context.put(FreemarkerServlet.KEY_APPLICATION, new
> ServletContextHashModel(this, wrapper));  
> context.put(FreemarkerServlet.KEY_REQUEST, new HttpRequestHashModel(req,
> res, wrapper));
>
> This prevents the error saying it could not process the JspTagLibs directive
> but my tags:
>
> <authz:authorize ifAllGranted="General">
> ...
> </authz:authorize>
>
> is being ignored. I have the same problem with JSTL tags as well. I only

In FreeMarker <authz:authorize ifAllGranted="General"> is plain static
text, so it is printed to the output as is (it isn't ignored), like
any other XML or HTML markup. JSP tags are just FreeMarker directives,
nothing special, so you use the FreeMarker directive call syntax for
calling them:

  <@authz.authorize ifAllGranted="General">...</@authz.authorize>

Note that in the FreeMarker directive call syntax you don't use ${...}
as in JSP, and don't quote the parameter values. So you do NOT write:
<@my.jspTag color="${theColor}" width="100" height=${a+b} name="aStringLiteral">
but
<@my.jspTag color=theColor width=100 height=a+b name="aStringLiteral">.

> have this problem with Freemarker. If I am using a JSP everything works OK.
> I have tried adding the following to my web.xml:
>
> <servlet>
>         <servlet-name>JspSupportServlet</servlet-name>
>        
> <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
> </servlet>
> <listener>
>      
> <listener-class>freemarker.ext.jsp.EventForwarding</listener-class>
> </listener>
>
> If anyone can give me a hint as to where I am going wrong I would be
> grateful.

-- 
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.