Desktop-like UI implementations for Java web applications?

Posted by localshred on Stack Overflow See other posts from Stack Overflow or by localshred
Published on 2009-08-19T22:30:28Z Indexed on 2010/04/21 4:13 UTC
Read the original article Hit count: 248

Filed under:
|
|
|
|

At work we're discussing upgrading our view layer for our web application. We're currently running an old and "modified" version of FreeMarker Classic, which is a pain to work with. One of our developers suggested using a Component UI style architecture similar to desktop style environments.

Essentially, this would mean that you would build custom HTML components as Java Classes that the controller would render into the Document view. This would completely take away the need to write HTML into a view layer. The Components would generate the view layer for you.

For instance, the following rendered HTML:

<h1>I am a title</h1>
<p>I am a paragraph.</p>

Would be generated by doing something like:

String titleString = "I am a title";
html.elements.Heading heading = new html.elements.Heading(Heading.H1, titleString);

String paraString = "I am a paragraph.";
html.elements.Paragraph paragraph = new html.elements.Paragraph(paraString);

PrintWriter somePrintWriter = new PrintWriter();
Document document = new Document();
document.addElement(heading);
document.addElement(paragraph);
document.compose(somePrintWriter);

The above code is just an example, don't critique the names or style, I just wrote it for a quick demonstration of what we may be trying to accomplish. I'm trying to determine if this has been done before in Java, and if so if there are any links I can be pointed to. I've been researching it as much as I can, but haven't found any implementations that completely remove the template layer (such as JSP or JSF).

Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about ui