RESTful with Stripes

Sep 21 2009

stripes是一个基于Annotation的Java MVC Framework,而且还提供了强大的RESTful特性,甚至可以直接将url绑定到Action类中的方法上,
比如有一个Action用来处理与用户有关的请求,其中有一个方法用来处理注册,而你就可以使用@UrlBinding like this:

@UrlBinding("/user/{$event}/{identifer}")
public UserActionBean extends ActionBean{
   private String identifer;
   public void setIdentifer(String identifer){
    this.identifer=identifer;
   }
   public String getIdentifer(){
     return this.identifer;
   }
   public Rasolution register(){
    .....
   }
}

此时,你就可以通过www.xxx.com/user/register/1 来注册用户了

Tags:

No responses yet

Leave a Reply