Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Pete Helgren
Replacing jsp's with Freemarker Templates
December 3, 2012 2:34 PM
Answer

Pete Helgren

Rank: Regular Member

Posts: 117

Join Date: April 7, 2011

Recent Posts

I am not a jsp guy (not big on struts either) but I am comfortable with using Freemarker templates to display and process web pages. Any quick and dirty way to display a Freemarker template page instead of a jsp?

I threw together a MVC portlet and then couldn't figure out how to invoke the method that would render the Freemarker template. Removing the reference to the jsp in the portlet.xml makes it not display at all so I am guessing that there is some xml magic that needs to occur here or I need to create a different type of portlet.

I don't need anything fancy. Just an MVC portlet that uses a Freemarker template page as the View instead of a jsp.

Ideas?

Thanks
Pete Helgren
RE: Replacing jsp's with Freemarker Templates
December 3, 2012 3:01 PM
Answer

Pete Helgren

Rank: Regular Member

Posts: 117

Join Date: April 7, 2011

Recent Posts

Answer to my own question: Liferay already has a view resolver for ftl files so all I needed to do to get the Freemarker template to display was to set the init-param for the view to point to the Freemarker template and LR did the rest. I still have many questions about this approach (like, can you invoke a portlet method that will display a template for some pre-processing steps) but this will do for now.