forked from itstamen/rop
-
Notifications
You must be signed in to change notification settings - Fork 0
Five minutes quick start
itstamen edited this page Mar 2, 2012
·
39 revisions
We need to create new account through Rop framework.
package com.stamen.sample.rop.request;
import com.stamen.rop.RopRequest;
import org.springframework.format.annotation.NumberFormat;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Pattern;
public class CreateUserRequest extends RopRequest {
@Pattern(regexp = "\\w{4,30}")//① constraint of the field
private String userName;
@Pattern(regexp = "\\w{6,30}")//②
private String password;
@DecimalMin("1000.00")
@DecimalMax("100000.00")
@NumberFormat(pattern = "#,###.##")//③
private long salary;
//getter and setter...
}
The ①、② and ③ is the JSR 303 annotation,ROP use the JSR 303 to validate the request data.If the request datais invalid ,ROP will generate the standard error respone(see the ROP error system for detail).