If the request isn't hitting an action or the S2 interceptor stack and
filter there will not be a value stack... if you just request an ftl it
won't be processed by S2 at all, no?

Options include making an actual S2 request, passing in messages to the JS,
creating a global message object and referencing it from the JS, and so on.

Dave
On Nov 12, 2010 8:48 PM, <struts....@spamgourmet.com> wrote:
> I have an action and freemarker result that includes an external
Javascript file. This javascript files needs to be able to use the getText()
method. I figured I'd name it "util.js.ftl" so that accessing it directly
caused the sitemesh-freemarker filter to catch it, but this throws a
NullPointerException (maybe because there's no ActionContext?):
>
> GET /myservlet/util.js.ftl
> java.lang.NullPointerException
>
org.apache.struts2.sitemesh.FreemarkerDecoratorServlet.process(FreemarkerDecoratorServlet.java:176)
>
org.apache.struts2.sitemesh.FreemarkerDecoratorServlet.doGet(FreemarkerDecoratorServlet.java:130)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:85)
>
com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
>
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:82)
> rss.web.filter.SkinFilter.doFilter(SkinFilter.java:98)
>
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> The action is simple and just returns SUCCESS.
>
> <action name="index" class="com.rgm.action.IndexAction">
> <result name="success" type="freemarker">index.ftl</result>
> </action>
>
> Is there a recommended way for a result template to load external files
such that they are separate GET requests from the browser, but are still
parsed through the Sitemesh-Freemarker filters and servlets, with access to
the value stack? If I simply <#include "*/util.js.ftl" /> then the content
is inlined -- this is not what I'm after.
>
> I am using Struts 2.2.1 with Sitemesh+Freemarker Decorators as described
on the sitemesh-plugin.html doc in the "Full Integration" section.
>
> Sincerely,
> Roland

Reply via email to