Reputation: 11
I want to use jawr taglib in my freemarker template. for example this code i'm using in jsp:
<%@ taglib uri="http://jawr.net/tags" prefix="jwr" %>
...................
<jwr:style src="/bundles/final.css"/>
............. etc
i tried this in ftl :
<#assign jawr=JspTaglibs["http://jawr.net/tags"]/>
<!DOCTYPE html>
<html>
<head>
<@jawr.style src="/bundles/final.css"/>
</head>
and getting same error:
Error executing FreeMarker template
FreeMarker template error:
The following has evaluated to null or missing:
==> JspTaglibs [in template "page/templates/freemarker/profile/pure_html_profile.ftl" at line 1, column 15]
----
Tip: The "JspTaglibs" variable isn't a core FreeMarker feature; it's only available when templates are invoked through freemarker.ext.servlet.FreemarkerServlet (or other custom FreeMarker-JSP integration solution).
...................
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign jawr = JspTaglibs["http://jaw... [in template "page/templates/freemarker/profile/pure_html_profile.ftl" at line 1, column 1]
----
Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:131)
at freemarker.core.DynamicKeyName._eval(DynamicKeyName.java:54)
..............
my jersey controller code:
@Path ("/test")
public class test {
................
@GET
@Path("/{id}")
@Consumes("application/x-www-form-urlencoded")
@Produces("text/html")
public Viewable getHtml (@PathParam("id") Long id){
Viewable view = null;
// ... any app code for getting User object
Map<String, Object> m = new HashMap<String, Object>();
m.put ("user", user);
view = new Viewable("/profile/pure_html_profile.ftl", m);
return view;
}
}
how can i use jwr in freemarker template?
Upvotes: 1
Views: 491