Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

renderSnake 1.5 released

DZone's Guide to

renderSnake 1.5 released

·
Free Resource

renderSnake is a Java library for creating components and pages that produce HTML using only Java. Its purpose is to support the creation of Web applications that are better maintainable, allows for easier reuse, have testable UI components and produces compact HTML in an efficient way.

This is how a simple LoginFrom component looks like. Element and attributes are methods that you can write in a builder-like or fluent style.
//------------------------------------------------------------
public class LoginForm implements Renderable {

    public void renderOn(HtmlCanvas html) throws IOException {
        
        html
            .form(action("login").method("post").id("login-form"))
            .fieldset()
                .div()
                    .label(for_("name")).content("Username")                    
                    .input(type("text").name("name").id("name"))                    
                ._div()
                .div()
                    .label(for_("password")).content("Password")
                    .input(type("password").name("password").id("password"))                    
                ._div()
                .input(type("submit").value("Login"))
            ._fieldset()
            ._form(); 
    }
}
//------------------------------------------------------------

This release is leaner because

  • it removes some required dependencies  (apache commons-io, antlr stringtemplate)
  • it removes its own servlet for dispatching (spring, guice or your likes are better in this job)
  • it removes its own template encapsulation for antlr stringtemplate (if you really need templates then choose your own)

and is faster because bottlenecks found in profiling are taken care of and xml escaping is now open-coded.

This project is hosted at rendersnake.googlecode.com and has it own home on rendersnake.org (powered by rendersnake itself). Another showcase is found at 6hoek.com

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}