webeans demo 2: Login
Steps to run demo2:
- modify Login.java ( see below )
- using ant to generate the anotations. ( when using Java 5, no this step)
- compile it, hot-deploy it ( done by ide and framework runtime automatic)
- retest it
- ok, it will be improved than demo1
Features from this demo:
- webeans is POJO with metadata for extra information(we call model information)
- webeans is Model-Driven-Application without complex MDA tool, just using java to do the model
Login.java
public class Login{
/** @webeans.field length=16 maxlength=16 label="User Name" */
private String userName;
/** @webeans.field input=password length=12 maxlength=12 */
private String password;
.... getter/setter method ....
/** @webbeans.action */
public String login(){
// do login like
if( "admin".equals(userName) && "password".equals(password) ) return "Login Success"
else return "Login Failure";
}
}
0 Comments:
张贴评论
<< Home