The HTML Production for Java class library is an open source
class library that encapsulates the gory details of creating HTML
for use in JSP and Servlets. Access to the project is provided courtesy of
HTML Production for Java allows developers to create complicated HTML
structures by combining relatively simple objects together. For example,
most sites have a consistent look for all of the input forms for the site.
Rather than typing lots of HTML in the Servlets or JSPs, the developer should
be able to use our HTML production library to encapsulate
the presentation logic for the input forms. In the following example, the UI developer
describes a form in terms of defined fields and then asks a Form object to generate the
HTML for the form.
The client code would look like:
FormDescription form_description = new FormDescription("data", "Data", "Please enter some data. ");
InputGroupDescription personal_group =
new InputGroupDescription("Personal Information", "Please enter your personal information");
Form form = new Form("/silly/formValidationServlet", form_description, current_values);
Page page = new Page("Test Form", "./Default.css");
This allows the form to be constructed very easily and very naturally,
without any knowledge of HTML.
Developers can use a similar approach to develop their own reusable HTML producers for page
layouts, fancy navigation bars, etc. These producers can be used
from both Servlets or JSPs.
While this project will provide some high level structures, it is mostly
focused on providing solid building blocks that YOU can use to build
interesting project level components as described above. For example,
it encapsulates the complexity of the table tag inside of a Table class that
allows you to add any HTML producer to specific spots in the table:
Table layout = new Table();
Link link = new Link("./about.html");
link.add(new Text(Style.LINK, "About us");
Image spot = new Image("/images/spot.jpeg");