Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Java Development with the Spring Framework
This is the forum to discuss the Wrox book Professional Java Development with the Spring Framework by Rod Johnson, Juergen Hoeller, Alef Arendsen, Thomas Risberg, Colin Sampaleanu; ISBN: 9780764574832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Java Development with the Spring Framework section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 26th, 2007, 02:34 PM
Registered User
Join Date: Jun 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ftl templates don't resolve jsp tags


I'm using spring 2.0 MVC. I use FreeMarker and its ftls for creating my htmls. also have view resolver and freemarkerTaglibFactory. I use these all cause i do have some JSP tags that are included in the ftls. Whenever i build ModelAndView Object are a return value of the spring controller i get the correct resut, and both ftl and JSP tags are generating my lovely htmls.

The problem took place when I tried to get the html as String. I neede it cause i want the html repersentation to be sent as an email using some service i have. Service works fine and I could get the html generated from ftl. Only one problem is that: the ftl couldn't resolve JSP tags. This doesn't contradict with what i've already said the ftl could resolve JSP tags. cause the first case (JSP is resolved in ftl) was when i return a ModelAndView object to the controller, but the second case (JSP is NOT resolved in ftl ) I was calling ftl this way:
    public String printFTLtoString(Map dataModel, String templateName) {

        Writer writer = null;
            writer = new StringWriter();
            freemarker.template.Template template = getFreeMarkerConfigurer().getConfiguration().getTemplate(templateName);
            template.process(dataModel, writer);

        }catch(IOException ex){
            throw new IllegalArgumentException("No template exists with name: "+templateName);
        }catch(TemplateException ex){
            throw new RuntimeException("Couldn't generate string using template:"+templateName, ex);
        return writer.toString();
    }The bean freeMarkerConfigurer is the bean we usually define in IOC container

The bean freeMarkerConfigurer is the bean we usually define in IOC container when we use FreeMarker. could some one tells me why it can't resolve jsp that way although it resolve it when i return a ModelAndView Object?

thanks in advance and I hope i stated my problem clearly!!

Similar Threads
Thread Thread Starter Forum Replies Last Post
browser version and JSP-custom tags neetukk JSP Basics 1 December 6th, 2006 03:29 AM
XLS with XML containing JSP tags dom4j - weird! azudio XSLT 2 May 24th, 2006 08:32 AM
need to resolve this.,. razmar78 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 November 23rd, 2004 01:41 PM
cannot resolve symbol (struts) tomeksupergosc J2EE 2 November 23rd, 2004 01:19 PM
Error: Cannot resolve symbol "Beginning JSP" amcp2002 Wrox Book Feedback 2 July 22nd, 2003 03:30 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.