Template engines in Hippo cms

373 views
Skip to first unread message

Michael Belonosov

unread,
Mar 24, 2015, 4:13:00 AM3/24/15
to hippo-c...@googlegroups.com
Is there any way to connect template engines like Thymeleaf to Hippo CMS?

Hippo documentation describes only JSP and FreeMarker, but there are a lot of other engines.
For example with Spring MVC I can use everything - FreeMarker, thymeleaf, Velocity and others.
What for HST?
If I include correct dependencies in my project, will be HST tags preprocessed correctly?

Olivier Bourgeois

unread,
Mar 24, 2015, 9:40:37 AM3/24/15
to hippo-c...@googlegroups.com

Hi Michael,

I’ve just played a bit with Thymeleaf so I’m not aware of all the possibilities, but AFAIK you can include JSPs fragment in your Thymeleaf templates: by using Thymeleaf directives or Apache Tiles integration. It seems to me that it would be the easiest way to reuse the HST taglib from your Thymeleaf templates.

Other than that, this will require some servlet/HST configuration but you should be able to integrate Thymeleaf engine in your HST site webapp. You can have a look at the frameworks integrations documentation. This will give you an overview of how things works. But I believe your use case is simpler than what is described in this documentation: you just have to instruct HST not to process your Thymeleaf templates (and for instance let another servlet do it).

HTH,
Olivier.


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Woonsan Ko

unread,
Mar 24, 2015, 10:07:22 AM3/24/15
to hippo-c...@googlegroups.com
Do you want to use Thymeleaf or Velocity template for an HST Component
template?
If so, basically it is absolutely possible because HST container simply
dispatches the request to the template physical path (e.g,
/WEB-INF/jsp/test.jsp, /WEB-INF/ftl/test.ftl, /WEB-INF/vm/test.vm, etc.).
So, if you configure a *servlet* for the mapping (e.g, *.vm, *.ftl,
etc.), then the dispatching from HST container to the template *servlet*
will work fine. The templates will be able to read request attributes
(as model) and render those.
By the way, you should add suffixExclusions or prefixExclusions properly
for your template servlet. See [1] for detail.

I'm not sure if Thymeleaf supports a standalone servlet like Freemarker
or Velocity does. If so, you can easily configure it and set the
physical path of an hst template to that. Otherwise, maybe you can
consider a servlet by yourself.

Regards,

Woonsan

[1]
http://www.onehippo.org/library/concepts/web-application/hst-2-container-configuration.html
> --
> Hippo Community Group: The place for all discussions and announcements
> about Hippo CMS (and HST, repository etc. etc.)
>
> To post to this group, send email to hippo-c...@googlegroups.com
> RSS:
> https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
> ---
> You received this message because you are subscribed to the Google
> Groups "Hippo Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hippo-communi...@googlegroups.com
> <mailto:hippo-communi...@googlegroups.com>.
--
w....@onehippo.com www.onehippo.com
Boston - 745 Atlantic Ave, 8th Floor, Boston MA 02111
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466

Michael Belonosov

unread,
Mar 24, 2015, 10:45:05 AM3/24/15
to hippo-c...@googlegroups.com
Hi Olivier, basically I have two part of my site: infosite and service.
I want to run infosite under Hippo CMS, and integrate service with infosite. Service part uses Thymeleaf, so I think if I can use the same rendering in infosite. I have passed two sprints of  Hippo Developer Trail,
all of GoGreen templates are using <@hst**> tags, so in general my question is:
How can I use hst tags in Thymeleaf templates.
As I understood, there are no hst taglibrary for Thymeleaf as for FreeMarker.

You received this message because you are subscribed to a topic in the Google Groups "Hippo Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hippo-community/egUBJtpqpuU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hippo-communi...@googlegroups.com.



--
With best regards,
Michael A. Belonosoff

marijan milicevic

unread,
Mar 24, 2015, 11:04:41 AM3/24/15
to hippo-c...@googlegroups.com
Hi Michael,

On Tue, Mar 24, 2015 at 3:45 PM, Michael Belonosov <belon...@gmail.com> wrote:
Hi Olivier, basically I have two part of my site: infosite and service.
I want to run infosite under Hippo CMS, and integrate service with infosite. Service part uses Thymeleaf, so I think if I can use the same rendering in infosite. I have passed two sprints of  Hippo Developer Trail,
all of GoGreen templates are using <@hst**> tags, so in general my question is:
How can I use hst tags in Thymeleaf templates.
As I understood, there are no hst taglibrary for Thymeleaf as for FreeMarker.

you are correct. As far as I know, there are no plans (yet) to support Thymeleaf..
cheers
marijan

Olivier Bourgeois

unread,
Mar 24, 2015, 12:24:52 PM3/24/15
to hippo-c...@googlegroups.com
On Tue, Mar 24, 2015 at 3:45 PM, Michael Belonosov <belon...@gmail.com> wrote:
Hi Olivier, basically I have two part of my site: infosite and service.
I want to run infosite under Hippo CMS, and integrate service with infosite. Service part uses Thymeleaf, so I think if I can use the same rendering in infosite. I have passed two sprints of  Hippo Developer Trail,
all of GoGreen templates are using <@hst**> tags, so in general my question is:
How can I use hst tags in Thymeleaf templates.
As I understood, there are no hst taglibrary for Thymeleaf as for FreeMarker.

So, like I said, to use HST tags it seems you have to use Apache Tiles to integrate JSPs into your Thymeleaf templates. You should check that with Thymeleaf experts though, there may be better options that I am not aware of.

"Mix JSPs and Thymeleaf templates in the same definition, for better legacy integration / migration."
 

Regards,
Olivier.

Jeroen Reijn

unread,
Mar 31, 2015, 3:25:35 AM3/31/15
to hippo-c...@googlegroups.com
I think this is a very interesting topic. I've been following thymeleaf after the research I did about template engines for Spring based applications [1]. I really like the concept of natural templating  that thymeleaf offers, however it is a bit slower because it's DOM based.

If you come up with a working example I would love to see it. Otherwise I will take a look at it myself as well. Maybe we can combine forces and share some code on github?

Jeroen Reijn
Hippo

Amsterdam office - Oosteinde 11, 1017 WT Amsterdam
Boston office - 745 Atlantic Ave, Eight Floor, Boston MA 02111, United states of America.


US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466

Michael Belonosov

unread,
Mar 31, 2015, 1:24:18 PM3/31/15
to hippo-c...@googlegroups.com
Your presentation was the first I'd read before start using thymeleaf=)
Unfortunately, I didn't prepare anything for thymeleaf yet.

Its an interesting idea to mix JSPs and Thymeleaf together, but I think it shoudn't be main way.
Thymeleaf is using dialects as its main approach.
For example, there is standart dialect, which includes all common thymeleaf tags, and SpringStandartDialect - for Spring mvc integration.
Spring security dialect realized same way.
So I think that new HST Dialect for thymeleaf will be the best approach.

As for me, after using Thymeleaf Freemarker really terrified me=)

вторник, 31 марта 2015 г., 10:25:35 UTC+3 пользователь j.reijn написал:

Olivier Bourgeois

unread,
Apr 1, 2015, 4:40:26 AM4/1/15
to hippo-c...@googlegroups.com
On Tue, Mar 31, 2015 at 7:24 PM, Michael Belonosov <belon...@gmail.com> wrote:
Your presentation was the first I'd read before start using thymeleaf=)
Unfortunately, I didn't prepare anything for thymeleaf yet.

Its an interesting idea to mix JSPs and Thymeleaf together, but I think it shoudn't be main way.
Thymeleaf is using dialects as its main approach.
For example, there is standart dialect, which includes all common thymeleaf tags, and SpringStandartDialect - for Spring mvc integration.
Spring security dialect realized same way.
So I think that new HST Dialect for thymeleaf will be the best approach.
I do agree: that sounds more like the right way to do it, however that seems also to be requiring - much ? - more work. I'll have a look at the Spring MVC integration just for my own enlightenment.
 

As for me, after using Thymeleaf Freemarker really terrified me=)
:-)
Reply all
Reply to author
Forward
0 new messages