Re: simple layout not working

S Ahmed <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CAG2rwuP6u0bd=J35yYokJn8fwvWt0n8AsOgYQ03ASxEdCFUKFw@mail.gmail.com>
Great that worked.  It was the path that was wrong, intellij doesn't seem
to pickup the path correctly.  it is signalling the now correct path
/layout/master.flt as red (something is wrong), but before it didn't
complain....

On Wed, Mar 28, 2012 at 3:33 AM, Daniel Dekany <[email protected]> wrote:

> Wednesday, March 28, 2012, 4:43:02 AM, S Ahmed wrote:
>
> > 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
>
> There should be a "Caused by:" part as well. I suppose it says
> java.io.FileNotFoundException.
>
> > 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>
>
> From the error message it seems that your template root directory is
> /WEB-INF/views. So it should be <#import "/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?
>
> --
> Best regards,
>  Daniel Dekany
>
>

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
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.