Re: Include JSP page in freemarker page

Attila Szegedi <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On Oct 17, 2008, at 10:10 PM, Rhett Sutphin wrote:

>> Guys, we still should add that servlet_include stuff to the
>> FreemarkerServlet, after all we give access out-of-the-box to the
>> Servlet scopes too, so, you see, it meant to be a dirty but instant
>> replace-your-JSPs solution, which it isn't without Servlet include,
>> IMO.
>
> A similar useful feature would be support for JSP 2.0 tagfiles (i.e.,
> taglibs that are written using JSP code instead of java code).
>
> I looked at adding support for this to freemarker a few months ago,
> but with no luck.  I'm hoping I just missed something and it would be
> as easy as you suggest adding servlet_include would be.

*sigh* As the guy who wrote the current FreeMarker JSP taglib support,  
I have to tell you that no, it isn't so easy, unfortunately, because  
we'd need to write a full parser for JSP pages. I don't see this  
happening - it'd require FreeMarker to ship a JSP parser in its JAR  
file. A "good enough" solution might be to leverage an existing JSP  
compiler implementation if one is found in the classpath... If we'd  
just bind to whatever is Tomcat's implementation, we'd probably serve  
a fair chunk of the user base :-) (Provided we can get at it from a  
webapp; Tomcat is notorious for hiding implementation classes from  
webapps, not that I disagree with that architecturally).

Of course, If you're running with FreeMarker, FM's namespaced macro  
libraries are superior solution in all regards. That's one of things  
that tick me off BTW, but I don't want to veer into a rant (too much)  
here -- here we are, with a solution that's technologically and even  
from a programming language theory point of view much cleaner than JSP  
ever was or ever will be, and people keep using this half-baked,  
poorly conceived thrown-together set of hacks collectively named JSP.

So, if you can, I'd advise you to just forget about tagfiles and  
transition to FM macro libraries. If you're stuck with third-party JSP  
libraries implemented as tagfiles though, then yeah, that's another  
matter, and tough luck for now... But I really don't see how can we  
support that without access to JSP parsing functionality, and even  
then...

Attila.

> Rhett


-------------------------------------------------------------------------
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=/
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.