Coder Social home page Coder Social logo

Comments (4)

danielfernandez avatar danielfernandez commented on June 12, 2024

Your Spring configuration looks alright, at first sight. The TilesConfigurer bean is independent, there is no relation between it and the other beans and that is normal (it mimics the behaviour of Spring's own TilesConfigurer).

Are you receiving any errors? If so, how do they look like?

from thymeleaf-extras-tiles2.

menganox avatar menganox commented on June 12, 2024

Yes, I'm sorry, I forgot to write the error:

javax.servlet.ServletException: Could not resolve view with name 'welcometiles' in servlet with name 'springDispatcher'

it seems like tile's configuration it is not ok, but I think it is! I'll let you know when the solution is made...

Tiles:

<definition name="baselayout" template="/WEB-INF/templates/baselayout.html">
    <put-attribute name="title" value="Template" type="string" />
    <put-attribute name="header" value="header.html" />
    <put-attribute name="menu" value="menu.html" />
    <put-attribute name="body" value="body.html" />
    <put-attribute name="footer" value="footer.html" />
</definition>

<definition name="welcometiles" extends="baselayout">
    <put-attribute name="title" value="Welcome" type="string" />
    <put-attribute name="body" value="welcome.html" />
</definition>

from thymeleaf-extras-tiles2.

danielfernandez avatar danielfernandez commented on June 12, 2024

Hi again,

Now I can see your definitions, I can see the errors in your configuration.

Your view resolver (Thymeleaf's) can specify the view names it can resolve by means of the viewNames attribute. In your configuration, it reads like this:

<property name="viewNames" value="*.html, *.xhtml, *.xml" />

Which means that the ThymeleafViewResolver will only consider it can handle a view if its name ends with *.html, *.xhtml, etc.

But your view is called welcometiles. It doesn't end with any of those suffixes.

The fact is that the viewNames property in view resolvers is only useful when your application has more than one of these (for example, if you are using Thymeleaf for some pages and JSP for some other pages), so that each view resolver can know whether the requested views should be resolved by it or not. So if you don't have more than one view resolver... I would simply remove that property.

But there are some additional problems in your Tiles configuration: you are specifying a template like /WEB-INF/templates/baselayout.html, but your Thymeleaf template resolver is already configured to add the /WEB-INF/templates/ prefix and the .html suffix to any template name it is requested, so asking for this template would result in actually looking for /WEB-INF/templates//WEB-INF/templates/baselayout.html.html.

You should simply specify your template as baselayout. And the same goes for header, menu, body, etc.

Regards,
Daniel.

from thymeleaf-extras-tiles2.

menganox avatar menganox commented on June 12, 2024

yes! it worked... thanks!

from thymeleaf-extras-tiles2.

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.