thymeleaf / thymeleaf.github.io

Thymeleaf website
https://www.thymeleaf.org
14 stars 16 forks source link

Javadoc needs an update to match with the published code? #18

Closed JurrianFahner closed 7 years ago

JurrianFahner commented 8 years ago

In the javadoc about TemplateEngine the following code snippets are published:

final IContext ctx = new Context();
ctx.setVariable("allItems", items);

and

final IContext ctx = new WebContext(request, servletContext);
ctx.setVariable("allItems", items); 

The problem with this code is that the interface IContext doesn't have the the setVariable and setVariables methods in version 2.1.4.RELEASE.

The workaround is to apply (by not programming to an interface):

final Context ctx = new Context();
ctx.setVariable("allItems", items);

So it is not a great problem, anyway...

ultraq commented 7 years ago

Looks like it was still a problem in the 3.0 branch too. Fixed to appear in the next patch for the 3.0 and 2.1 branches of Thymeleaf.