One strategy for creating model - view -controller structures is to use a "thin" servlet as the controller, a backend class as the model or interface to the model, and an XSL transformer class as the view component.
For example, the servlet can simply determine the client's intentions -- in a large case statement, a sequence of if-then-else statements, or some other similar construct -- and then call the appropriate method in a backend class that represents the outer layer of the model. Once the model performs the requested action, it returns the results as an XML string to the servlet. The servlet then passes this result XML string to a view class that uses an XSL style to transform it into HTML that is returned to the client.
This lessons works through and discusses this architecture.
Architecture
XML is very general and can be used in many different ways. Here, an architecture is discussed that conforms to the general model-view-controller architecture and is well-suited for form-based interaction with a semantic object, such as a DBMS application.
Issues
Issues or decisions that must be dealt with in order to use these resources in any given application.
XML Document
A simple example XML document is provided here.
XSL Stylesheet
A simple example XSL stylesheet is provided that can be used with the example XML document, listed above.
XML Transform Class
An XSL translator is shown as a Java class, suitable for use as the view component of a Servlet controller. It takes a simple XML document and XSL stylesheet and produces HTML output that is written to the Servlet's ServletOutputStream.
Login Form Example
Designing and building a non-trivial XSL stylesheet to build form-based user interface views in HTML. The design is based on layers of XSL templates and is illustrated using an example Login form.
XSL Deployment
Deploying the application classes as well as the XSL files needed by the Transformer.
XSL Componets
Quick-Start introduction to major XSL components.