Re: Using JspTaglibs outside servlet context

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Tuesday, December 11, 2007, 10:15:14 AM, Albertas Mickenas wrote:

> Hi all,
>
>
> I'm trying to accomplish rather an exotic setup.
>
> I'm programming portlets. I'm using Spring and Spring Webflow for that.
> I'm using freemarker with portlet tld.
>
> What i'm trying to do is to create Unit tests for my Webflow states in
> every state i want to check if the template compiles OK.

You mean, check if the template *executes* OK?

> To do that i get freemarker configurer from Spring context:
>
> freemarkerConfig = (FreeMarkerConfigurer)
> context.getBean("freemarkerConfig");
>
> then i get the template, set view name and model to it and try to
> process it.
>
> The problem is with JspTaglib - freemarker does not seem to find it. As
> far as i dug into freemarker sources, i see JspTaglibFactory created and
> used only in FreemarkerServlet.
>
> The question is - can i use JspTaglibs outside servlet context?

That's a strange question, because the JSP tags themselves need
servlet environment. That is, even if JspTaglib somehow magically
works outside it, you still will not be able to execute the templates,
since the JSP tags surely need the servlet environment. So you will
need to setup a mock servlet environment somehow. (I guess you can
find some examples of that in the test suite of FreeMarker.)

-- 
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
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.