Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arey/spring-mvc-toolkit

Additional features to the Spring MVC module of the Spring Framework
https://github.com/arey/spring-mvc-toolkit

Last synced: 2 months ago
JSON representation

Additional features to the Spring MVC module of the Spring Framework

Awesome Lists containing this project

README

        

# Spring MVC Toolkit #

This toolkit provides additional features to the Spring MVC module of the Spring Framework.

## Features ##

* Input tag supporting HTML 5 form validation by using Bean Validation constraints

## Documentation ##

**Html5InputTag**

This JSP tag adds HTML 5 form validation to the default Spring MVC input tag by using Bean Validation constraints.
It supports:
* @Max, @Min, @NotNull @Size annotations form the Bean Validation API.
* Custom @Email, @NotEmpty and @URL annotations from the Hibernate Validator implementation

Here the mapping between Java and HTML 5 code:



Java Code
JSP Page
Generated HTML 5




@NotEmpty
String firstName;
<jem:input path="firstName" />
<input id="firstName" type="text" required="required" />


@NotNull
String city;
<jem:input path="city" />
<input id="city" type="text" required="required" />


@Size(max=40)
String address;
<jem:input path="address" />
<input id="address" type="text" maxlength="40" />


@Size(max=40)
String address;
<jem:input path="address" maxlength="20" />
<input id="address" type="text" maxlength="20" />


@Min(value=18)
@Max(value=99)
Integer age;
<jem:input path="age" />
<input id="age" type="number" min="18" max="99" />


@Email
String email;
<jem:input path="email" />
<input id="email" type="email" />


@URL
String website;
<jem:input path="website" />
<input id="website" type="url" />


Integer birthYear;
<jem:input path="birthYear" />
<input id="birthYear" type="number" />

**Tutorial**

French articles on the javaetmoi.com blog:
* [Validation HTML 5 avec Spring MVC et Bean Validation](http://javaetmoi.com/2014/09/validation-html-5-avec-spring-mvc-et-bean-validation/)

## Quick Start ##

Download the jar though Maven:

```xml

com.javaetmoi.core
spring-mvc-toolkit
0.1

```

Spring MVC Toolkit artefacts are available from [Maven Central](http://repo1.maven.org/maven2/com/javaetmoi/core/spring-mvc-toolkit/)

## Demo ##

Download the code with git:
```
git clone git://github.com/arey/spring-mvc-toolkit.git
```

Compile the code with maven:
```
cd spring-mvc-tookit
mvn clean install
```

Run jetty
```
cd spring-mvc-toolkit-demo
mvn jetty:run-war
```

Open your browser and goto:
* http://localhost:8080/htmlvalidation for demo of the Html5InputTag

![Html 5 validation page Screenshot](https://raw.githubusercontent.com/arey/spring-mvc-toolkit/gh-pages/img/html5-input-validation-with-spring-mvc.png "Html 5 validation page Screenshot")

## Contributing to Spring MVC Tookit ##

* Github is for social coding platform: if you want to write code, we encourage contributions through pull requests from [forks of this repository](http://help.github.com/forking/). If you want to contribute code this way, please reference a GitHub ticket as well covering the specific issue you are addressing.

### Development environment installation ###

Download the code with git:
git clone git://github.com/arey/spring-mvc-toolkit.git

Compile the code with maven:
mvn clean install

If you're using an IDE that supports Maven-based projects (InteliJ Idea, Netbeans or m2Eclipse), you can import the project directly from its POM.
Otherwise, generate IDE metadata with the related IDE maven plugin:
mvn eclipse:clean eclipse:eclipse

## Release Note ##


VersionRelease dateFeatures

0.2.0-SNAPSHOTnext version


0.130/08/2014Html5InputTag for HTML 5 validation from Bean Validation constraints

## Credits ##

* Uses [Maven](http://maven.apache.org/) as a build tool
* Uses [Cloudbees](http://www.cloudbees.com/foss) and [Travis CI](www.travis-ci.org) for continuous integration builds whenever code is pushed into GitHub

## Build Status ##

Travis : [![Build
Status](https://travis-ci.org/arey/spring-mvc-toolkit.png?branch=master)](https://travis-ci.org/arey/spring-mvc-toolkit)

Cloudbees Jenkins : [![Build
Status](https://javaetmoi.ci.cloudbees.com/job/spring-mvc-toolkit/badge/icon)](https://javaetmoi.ci.cloudbees.com/job/spring-mvc-toolkit/)