- Easy-to-use configurable handy tool.
- Automatic binding, even to immutable objects, collections and arrays, nested objects and lists of them.
- Support for (non)default constructors, static factory methods.
- Primitives can be used everywhere.
- Validation of form data (both bean validation API annotations and net.formio.validation.Validator can be used).
- Seamless support for file uploads and configurable max. request/file size.
- Form definitions are immutable, composable, self-contained, can be easily shared and cached.
- Automatic generating of form markup (or its parts) can be optionally used.
- One simple entry point to API: Forms class.
- Non-invasive, easy integration with frameworks, minimum dependencies.
- Usable with various template frameworks, in environments with or without servlets, portlets, also in desktop applications.
- Simply unit testable forms.
- Protection of forms against CSRF attacks.
- Inspired mainly by well-designed Play framework.
http://search.maven.org/#search|ga|1|net.formio
http://formio-demo.herokuapp.com/, sources on https://github.com/beranradek/formio-demo
1) Prepare form definition (optional automatic mapping of properties):
private static final FormMapping<Person> personForm =
Forms.automatic(Person.class, "person").build();
2) Fill it with data:
FormData<Person> formData = new FormData<Person>(person, ValidationResult.empty);
FormMapping<Person> filledForm = personForm.fill(formData);
// Push the filled form into a template, use its properties to render it;
// or use BasicFormRenderer to generate form markup automatically
3) Bind data edited by user back into an object:
FormData<Person> formData = personForm.bind(new ServletRequestParams(request));
if (formData.isValid()) {
// save the person: formData.getData()
} else {
// show again the invalid form with validation messages
// personForm.fill(formData) ...
}
- Build artifacts (jar, sources, javadoc): gradle clean assemble
- Import into Eclipse: gradle cleanEclipse eclipse
- Run tests: gradle test
- Perform release: gradle clean release
- Installation to local Maven repository (e.g. for testing snapshots): gradle install
- Just run: gradle clean test assemble to see all is ok and ready for release.
- Run: gradle clean release
- This automatically executes also uploadArchives (upload to Maven central) after the release version is created
- Push commits from Gradle release plugin to GitHub
- Login to https://oss.sonatype.org/, "Close" the Staging repository for library, "Refresh" it and "Release" it.
See http://central.sonatype.org/pages/ossrh-guide.html#releasing-to-central and http://central.sonatype.org/pages/gradle.html for details.
- Deleting tag in remote repository:
git tag -d formio-x.y.z
git push master :refs/tags/formio-x.y.z