Java Mailing List Archive

http://www.junlu.com/

Home » FreeMarker-user »

[FreeMarker-user] simple layout not working

S Ahmed

2012-03-28

Replies: Find Java Web Hosting

Author LoginPost Reply
I'm getting this error:

Error reading imported file WEB-INF/views/layout/master.ftl The problematic instruction: ---------- ==> import "/WEB-INF/views/layout/master.ftl" as p [on line 1, column 1 in home/index.ftl] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateException: Error reading imported file WEB-INF/views/layout/master.ftl at freemarker.core.LibraryLoad.accept(LibraryLoad.java:122) at freemarker.core.Environment.visit(Environment.java:221) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:221) at freemarker.core.Environment.process(Environment.java:199) at freemarker.template.Template.process(Template.java:259) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.processTemplate(FreeMarkerView.java:366) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.doRender(FreeMarkerView.java:283) at org.springframework.web.servlet.view.freemarker.FreeMarkerView.renderMergedTemplateModel(FreeMarkerView.java:233) at org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1157) at 

My 2 templates are in:

/web-inf/views/layout/master.ftl
/web-inf/views/home/index.ftl


index.ftl:

<#import "/WEB-INF/views/layout/master.ftl" as p>
<@p.page "abc">
    nested goes here
</@p.page>


master.ftl:

<#escape x as x?html>

    <#macro page title>
    <!DOCTYPE html>

    <html>
    <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
        <title>${title}</title>
 ...
..
 <#nested>
..
..

    </body>
    </html>
    </#macro>
</#escape>


Does anything seem wrong here?


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
FreeMarker-user mailing list
FreeMarker-user@(protected)
https://lists.sourceforge.net/lists/listinfo/freemarker-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.