Re: Generics and Freemarker model
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Sunday, March 23, 2008, 11:16:01 PM, krishnan.1000 wrote: > Hi, > > My answers in bold (In bold? You sent a plain text mail. Whatever...) > Daniel Dekany wrote: >> >> Sunday, March 23, 2008, 2:21:36 AM, krishnan.1000 wrote: >> >>> Hi , >>> >>> I am trying to use freemarker template to load the ftl file. >> >> What do you mean by that? A FreeMarker template *is* an FTL "file". >> > I am using a ftl file to render a template. I am sorry if that sounded > confusing. > >>> I am trying to load 4 java.lang.String objects and the List<String> >>> into the template file. >> >> What do you mean by loading it into it? > > By loading, I mean merge the template and data model using > Template.process(Map, Writer) It sounds like the standard use case, so I hope the Getting Started chapter has helped: http://freemarker.org/docs/pgui.html >>> My question is when I am populating the HashMap<String, Object> with >>> the appropriate values. >> >> You mean that data-model? Normally you populate it before calling the >> template. > > Yes, I mean the datamodel > >>> I am new at generics and freemarker so I hope this is not a silly >>> question. Is this a right way to use generics with the domain model >>> hash map? >> >> Your questions weren't clear, so I can't answer that. But look into >> the Manual. Read at least the Getting Started chapter; it's short: >> http://freemarker.org/docs/pgui.html >> > By this, I mean is this a right way to have the data model of the such a > type Map<String,Object> if I have to merge template with the data model. Yes, the data-model can be a Map<String, Object>. (Or actually it can be a a JavaBean as well, or anything that is wrapped into a TemplateHashModel by the Configuration-level ObjectWrapper.) >>> Hoping for a reply? >> >> That's a question that only you can answer... :) >> >>> Thanks, >>> >>> Krishnan >> >> -- >> Best regards, >> Daniel Dekany -- Best regards, Daniel Dekany ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/