Skip to content

How to use ViewPreparer?  #21

@hurelhuyag

Description

@hurelhuyag

I tested sample ViewPreparer. but doesn't work.

@Component("testPreparer")
public class TestPreparer implements ViewPreparer {

    @Override
    public void execute(TilesRequestContext tilesContext, AttributeContext attributeContext) {
          attributeContext.putAttribute("message", new Attribute("hello world"));
    }
}

in definition:

<definition name="signin" template="signin" preparer="testPreparer" />

signin.html

...
<div th:text="${message}">prototype message</div>
...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions