Git Product home page Git Product logo

Comments (11)

marceloverdijk avatar marceloverdijk commented on May 20, 2024

+1 would love to see this

from thymeleaf.

ultraq avatar ultraq commented on May 20, 2024

@danielfernandez What kind of servlet do you envision for this? I already run a Spring-less Thymeleaf site, so I could just extract my template servlet into its own library (much like I did with the layout dialect) or as an extra?

from thymeleaf.

jmiguelsamper avatar jmiguelsamper commented on May 20, 2024

I think this is the Velocity servlet that Daniel told about http://velocity.apache.org/tools/devel/view.servlet.html

from thymeleaf.

danielfernandez avatar danielfernandez commented on May 20, 2024

Basically, I thought of this as a way to create thymeleaf-only web applications in a similar fashion to the way people can create ASP-only web applications on an IIS or JSP-only web applications on a Tomcat/Jetty/whatever.

This is, a servlet that takes URLs (probably only .html URLs) and redirects them to thymeleaf templates which will do the processing.

And what processing, you might ask, if by the time we have our thymeleaf template executing itself we will have no context at all? Correct, but we will have two things:

  • The URL parameters, accessible with ${param.*}
  • Our beautiful future shiny SQL dialect :-D defined in #36

And those should be enough to get data to work with in a Thymeleaf-only way...

from thymeleaf.

ultraq avatar ultraq commented on May 20, 2024

I'll see what I can get going for this sometime this week as well. I'll just throw it into one of my own repos for you to evaluate. I should also be able to get it working much more simply than the instructions on the Velocity page if I start with using Servlet 3.0 web fragments (sooo much easier than having to hack together the web.xml yourself), or maybe I'm just being too optimistic.

from thymeleaf.

ultraq avatar ultraq commented on May 20, 2024

So I got something going in this repo: https://github.com/ultraq/thymeleaf-template-servlet

It's a web fragment project, so can be imported into any web project and it'll automatically start working as per the config in the annotations here: StandaloneThymeleafServlet.java So the web container should support the Java web app 3.0 spec, and have annotation scanning turned on. (It shouldn't be too hard to create a non-annotation version, but I just went down this route because it's the easiest to get something going.) The init-params can also be overridden by developers in their web.xml files.

I created a mini web app (it's an Eclipse project, so is pretty hard to share right now) that imported this project and then had just HTML files in the web content folder. I could then go http://localhost:8080/test-project/path-to-html-file.html and voila! Thymeleaf template :)

from thymeleaf.

jmiguelsamper avatar jmiguelsamper commented on May 20, 2024

Oh, that's a nice toy!

I will try it at the end of this week, maybe doing an example application.

Regards,
  Zemi


De: Emanuel Rabina [email protected]
Para: thymeleaf/thymeleaf [email protected]
CC: Jose Miguel Samper [email protected]
Enviado: Martes 8 de abril de 2014 11:36
Asunto: Re: [thymeleaf] Create servlet for standalone execution of templates (#35)

So I got something going in this repo: https://github.com/ultraq/thymeleaf-template-servlet
It's a web fragment project, so can be imported into any web project and it'll automatically start working as per the config in the annotations here: StandaloneThymeleafServlet.java So the web container should support the Java web app 3.0 spec, and have annotation scanning turned on. (It shouldn't be too hard to create a non-annotation version, but I just went down this route because it's the easiest to get something going.) The init-params can also be overridden by developers in their web.xml files.
I created a mini web app (it's an Eclipse project, so is pretty hard to share right now) that imported this project and then had just HTML files in the web content folder. I could then go http://localhost:8080/test-project/path-to-html-file.html and voila! Thymeleaf template :)

Reply to this email directly or view it on GitHub.

from thymeleaf.

danielfernandez avatar danielfernandez commented on May 20, 2024

@ultraq Oops! I still haven't had a look at that! :-$

from thymeleaf.

jmiguelsamper avatar jmiguelsamper commented on May 20, 2024

The standalone servlet was integrated in the example app at https://github.com/jmiguelsamper/thymeleaf-extras-sqldialect which now is listed on the ecosystem page.

The only outstanding question is whether integrate the servlet into the Thymeleaf core or not.

from thymeleaf.

ultraq avatar ultraq commented on May 20, 2024

I think it shouldn't be core, and just get a mention in the ecosystem page like your SQL dialect and then we'll support them like we do with our other Thymeleaf add-on projects.

from thymeleaf.

danielfernandez avatar danielfernandez commented on May 20, 2024

👌

from thymeleaf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.