If preventing direct access to the templates by putting them under /WEB-INF,
just like you were doing with JSPs, is enough for you, that should work.

In other words, I've switched from JSPs to FTL in the way that you describe
and it worked; I did not get 404 errors. Note that you still need the
FreeMarker servlet to resolve forwarding to *.ftl, but that doesn't mean
the user will be able to access the templates directly. So the real question
is to resolve why you were getting those 404 errors.

If, on the other hand, the real question is that you want a different way
of preventing direct access to templates because putting them under /WEB-INF
is not what you want to do, then of course consider the alternatives that
others have suggested.

I just wanted to mention that putting FTL templates under /WEB-INF *should*
work.

Cheers,
Freddy
http://www.stripesbook.com

- I used Stripes with JSP and "action bean first" approach, (all JSPs were 
under 
- /WEB-INF/jsp/)
- 
- I used action beans like:
- 
- @UrlBinding("some-url.xhtml")
- public class HomeActionBean extends BaseActionBean {
- 
-     @DefaultHandler
-     @DontValidate
-     public Resolution display() {
-         return new ForwardResolution("/WEB-INF/jsp/home.jsp");  
-     }
- }
- 
- Now I want to use FreeMaker with "action bean first" approach
- I created "/WEB-INF/templates/home.tfl" placed freemaker jar to classpath
- 
- and changed code to:
- 
- @UrlBinding("some-url.xhtml")
- public class HomeActionBean extends BaseActionBean {
- 
-     @DefaultHandler
-     @DontValidate
-     public Resolution display() {
-         return new ForwardResolution("/WEB-INF/templates/home.tfl");  
-     }
- }
- 
- Now every time I open "some-url.xhtml" in the browser I always get
- "HTTP Status 404 - /DemoSite/WEB-INF/templates/home.tfl"
- 
- Please, note, I don't want to make free maker templates accessible directly, 
- for example, by /DemoSite/home.tfl 
- like will be when I use free maker filter:
- 
-  <servlet>
-         <servlet-name>Freemarker</servlet-name>
-         
<servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class>
-         <init-param>
-             <param-name>TemplatePath</param-name>
-             <param-value>/WEB-INF/templates/≤/param-value>
-         </init-param>
-         <init-param>
-             <param-name>template_update_delay</param-name>
-             <param-value>0</param-value> <!-- 0 is for dev only! Use higher 
- value otherwise. -->
-         </init-param>
-         <load-on-startup>1</load-on-startup>
-     </servlet>
- 
-     <servlet-mapping>
-         <servlet-name>Freemarker</servlet-name>
-         <url-pattern>*.ftl</url-pattern>
-     </servlet-mapping>
- 
- Any suggestion, how can switch from jsp to freemaker templates "action bean 
- first" approach and restrict any access to templates except through action 
- beans?



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to