FreeMarker support for struts2 problem

I been trying IntelliJ idea latest. Working on demo project. Struts2+Freemarker.

Problem is IntelliJ doesn't recognize or path to when I use type="freemarker" in action result. But when I run project is working fine. See below screen shot. I see only com. If I remove type="freemarker" than I see the page listed fine.

Thanks

intelli.gif

5 comments
Comment actions Permalink

The directories containing freemarker results must be marked as source roots.


0
Comment actions Permalink

Thanks. That means need to make webapp as source root?

0
Comment actions Permalink

I'd suggest to create a directory e.g. "views" under WEB-INF and mark that as source root.


0
Comment actions Permalink

I have created views folder under WEB-INF and marked it as source root as in the screen shot. If I do that than I see index.ftl page but no directory structure like <result type="freemarker">/WEB-INF/views/index.ftl</result> instead I use <result type="freemarker">index.ftl</result>. Running the projects gives an error as below but if I use /WEB-INF/views/index.ftl that is not resolved as in screen shot but page is loading fine.

I hope you understand.


Messages:
  • Template /index.ftl not found.
  • File: freemarker/template/Configuration.java
    Line number: 580

    Stacktraces

    java.io.FileNotFoundException: Template /index.ftl not found.
        freemarker.template.Configuration.getTemplate(Configuration.java:580)
        freemarker.template.Configuration.getTemplate(Configuration.java:550)
        org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:169)


    fm.gif

    0
    Comment actions Permalink

    Thanks for your detailed report, there was indeed a problem specific to Freemarker results which will be fixed in next EAP of IntelliJ IDEA 12. Then you'll be able to use "/WEB-INF/views/index.ftl" as full path without any additional source roots.

    0

    Please sign in to leave a comment.