chkal / mvc-spec-migration-test

0 stars 0 forks source link

Mechanism to bind template data #17

Closed chkal closed 9 years ago

chkal commented 9 years ago

Original issue MVC_SPEC-17 created by Santiago Pericas-Geertsen:

Controllers need to bind data for templates. For example, given the following template (JSP):

Title: ${book.title}

Author(s): ${book.author}

ISBN: ${book.isbn}

the "book" model needs to be bound before the rendering phase. There are few different ways in which this binding can take place. One such example is via an injectable Models type that implements a map. @Inject private Models models; public String html(@PathParam("id") String id) { models.set("book", catalog.getBook(id)); return "book.jsp"; // JSP to render a book } Another possibility is via CDI's @Named. These options are not necessarily mutually exclusive.
chkal commented 9 years ago

Comment by Santiago Pericas-Geertsen:

Currently exploring two mechanisms in proposal: using CDI and a Models class.

chkal commented 9 years ago

Comment by Santiago Pericas-Geertsen:

Models and CDI are now part of the API.