130 likes | 292 Views
This article discusses the challenges of manual form development in Java EE applications, particularly in JSF environments. It highlights how error-prone and tedious manual form generation can lead to inconsistencies and weak type safety. The authors introduce a new tool that enables automated form generation, allowing developers to create forms efficiently using XML configurations and templates. Examples illustrate the mapping of entity beans to form components, promoting client-side validation. The conclusion emphasizes the tool's potential to significantly reduce development time and enhance application robustness.
E N D
Form Builder TomášČerný Michael J. Donahoo Eunjee Song Department of Computer Science Baylor University, Waco, TX
Content • Introduction • Background • Manual form generation • Tool • Example • Related work • Conclusion
Introduction Java EE web applications JSF, Seam, Hibernate • Entity beans determine view forms • Manual form development is error-prone and tedious • Developer consistency • Weak type safety in view • Properties propagation • Entity bean inconsistency with view form • Form auto-generation by our tool • Client-side validation
Background • Java Platform, Enterprise Edition (Java EE) • Presentation tier - JSF • Business tier – Session bean • Persistence tier – Entity bean • Java Server Faces (JSF) • Rich user interface on server side • Components • Facelets (XHTML) • Templating framework • Enterprise JavaBeans (EJB) • Distributed applications
Manual form generation • What we want to create? • read-only and editable form
Manual form development • What do I need to know? • Field - component mapping • Horizontal properties • field type ► component type • Integer ► inputNumber component • Vertical properties • field annotation ► component type • String ► @Password ► inputPassword • mapping condition • String ► length > 255 ► inputTextArea
Tool • Java Application • XML configuration • Mapping field ► component template • Template-based form generation • Developer can use his favorite view components • Component libraries – client-side validation
Example @Entity @Table(name = “person”) publicclassPerson { privateString name; @NotNull @Length(max=100) publicString getName() { returnname; } publicvoidsetName(String name) { this.name = name; }
Example <rb:inputTextid="$id" edit="#{editable}" value="#{$value}" label="$label" size="$size" maxlength="$maxlength" required="$required"/>
Example <rb:inputTextid="name" edit="#{editable}" value="#{bean.name}" label="Name:" size="30" maxlength="100" required="true"/>
Conclusion Contribution • New tool for JSF applications • New development style • Significant development time decrease • Client-side validation Future work • Use the idea in Model Driven Development • Extend tool for table generation • Extend tool for test generation • New client-side validation (lower X greater)