Scaffolding has been significantly rewritten to use a new static Metawidget. This allows Forge to output pure JSF tags, with no runtime dependencies on any non-Java EE libraries. The UI includes creating, updating, deleting, pagination and searching. It also supports one-to-many, many-to-many, many-to-one and one-to-one relationships:
![]() | ![]() |
<h:panelGrid columnClasses="label,component,required" columns="3">
<h:outputLabel for="customerBeanCustomerFirstName" value="First Name:"/>
<h:panelGroup>
<h:inputText id="customerBeanCustomerFirstName" value="#{customerBean.customer.firstName}"/>
<h:message for="customerBeanCustomerFirstName" styleClass="error"/>
</h:panelGroup>
...
<h:outputLabel for="customerBeanCustomerFirstName" value="First Name:"/>
<h:panelGroup>
<h:inputText id="customerBeanCustomerFirstName" value="#{customerBean.customer.firstName}"/>
<h:message for="customerBeanCustomerFirstName" styleClass="error"/>
</h:panelGroup>
...
Behind the scenes, Forge is still using the same Metawidget pipeline as before - the same Inspectors, WidgetBuilders, WidgetProcesors and Layouts. This means the scaffolding is pluggable to adapt to your needs - including custom UI libraries, custom layouts, even custom langauges (Ceylon, anyone?).
The new static Metawidget is also used to generate Java code for the JSF backing beans. Again using WidgetBuilders and outputting very clean code:
String firstName = this.search.getFirstName();
if (firstName != null && !"".equals(firstName)) {
predicatesList.add(builder.like(root.<String>get("firstName"), '%' + firstName + '%'));
}
String lastName = this.search.getLastName();
if (lastName != null && !"".equals(lastName)) {
predicatesList.add(builder.like(root.<String>get("lastName"), '%' + lastName + '%'));
}
if (firstName != null && !"".equals(firstName)) {
predicatesList.add(builder.like(root.<String>get("firstName"), '%' + firstName + '%'));
}
String lastName = this.search.getLastName();
if (lastName != null && !"".equals(lastName)) {
predicatesList.add(builder.like(root.<String>get("lastName"), '%' + lastName + '%'));
}
Please give it a try!
- Download Forge Beta4
- Install it
- Run it
- Copy and execute this command:$ run-url https://raw.github.com/forge/core/master/showcase/posale.fsh