GithubHelp home page GithubHelp logo

sunlingfeng-daren / wicket-jsr303-parsley Goto Github PK

View Code? Open in Web Editor NEW

This project forked from code-troopers/wicket-jsr303-parsley

0.0 2.0 0.0 288 KB

Basic integration between Wicket, JSR303 and ParsleyJS client side validation library

Java 100.00%

wicket-jsr303-parsley's Introduction

Wicket JSR303 ParsleyJs integration

Thanks to Cloudbees buildhive for providing a free Jenkins instance. Build Status

Parsley.js is a client-side form validation library (documentation).

Apache Wicket is a Java Web framework providing clean separation between markup and logic.

JSR303 - Bean validation is a Java specification providing an easy way to define constraint on your model objects.

This project provides a simple way to get client side validation for POJOs annotated with Bean Validation's constraints.

Setup on your project

Add the following Maven dependency

<dependency>
    <groupId>com.code-troopers</groupId>
    <artifactId>wicket-jsr303-parsley</artifactId>
    <version>0.2</version>
</dependency>

To use it in your Wicket application, you will need to register Parsley with your application. Basically, you will add this code in your Application#init() method :

@Override
public void init(){
    super.init();
    Parsley.register(this);
}

For every form that you want to validate using Parsley, you will need to add ParsleyFormBehavior to your Form :

Form form = new Form("form");
form.add(new ParsleyFormBehavior());

Every FormComponent in the specified Form will get a correct validator (both client and server side). Please notice that you will need to use a model implementing IPropertyReflectionAwareModel in order for the tool to read annotation metadata.

JavaScript dependencies

This library depends on Parsley.Js via the artifact deployed on Webjars. This way you can easily use an updated version of the library in your project.

Bug tracker

Have a bug? Please create an issue here on GitHub!

https://github.com/code-troopers/wicket-jsr303-parsley/issues

Special notes

Many thanks to Martin Grigorov for the blog article which inspired me : http://wicketinaction.com/2013/04/server-and-client-side-validation/

Thanks to James Ward for the Webjars.org initiative : http://www.jamesward.com/2012/10/31/webjars-officially-launched.

The implementation provided here is open for pull request or further integration into WicketStuff.

Copyright and license

Copyright 2012 Code-Troopers.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.