Package com.sun.jersey.api.view

Provides support for Model, View and Controller (MVC).

See: Description

Package com.sun.jersey.api.view Description

Provides support for Model, View and Controller (MVC).

Given the MVC pattern the Controller corresponds to a resource class, the View to a template referenced by a template name, and the Model to a Java object (or a Java bean).

A resource method of a resource class may return an instance of Viewable that encapsulates the template name and the model. In this respect the instance of Viewable is the response entity. Such a viewable response entity may be set in contexts other than a resource method but for the purposes of this section the focus is on resource methods.

The Viewable, returned by a resource method, will be processed such that the template name is resolved to a template reference that identifies a template capable of being processed by an appropriate view processor. The view processor then processes template given the model to produce a response entity that is returned to the client.

For example, the template name could reference a Java Server Page (JSP) and the model will be accessible to that JSP. The JSP view processor will process the JSP resulting in an HTML document that is returned as the response entity. (See later for more details.)

Two forms of returning Viewable instances are supported: explicit; and implicit.

Explicit views

Implicit views

Integration with Java Server Pages (JSPs)

Developing a View Processor

Copyright © 2016 Oracle Corporation. All Rights Reserved.