webeans demo1
Steps to run demo1:
- Code Login.java(see below)
- Compile it( I like eclipse for its auto-increase compile)
- Deploy it (Just put the class under WEB-INF/webeans/classes directory and it will be hot-deployed automated)
- Test it from url http://localhost:8080/webeans/Login
- It should be run, display a form with two input field "userName" & "password", 1 button "Login"
- input and submit, it will display a message as "result is true" or "result is false"
Features of webeans from this demo:
- webeans is an framework support RAD, code such a demo costs no more than 5 minutes.
- webeans support hot-deploy feature to improve develop cycle.
- webeans follows the POJO pattern, no special interface or super class to be used, u just code u business model.
Features to be improved:
- The input field "userName" should be "User Name"
- The input field "userName" should be a text field with length 16 and don't permit long input than 16 chars
- The input field "password" should not be clear text for security
- The result page should be "Login success" or "Login failure"
Lets improve it at demo2
public class Login{
private String userName, password;
.... getter/setter method ....
public boolean login(){
// do login like
if( "admin".equals(userName) && "password".equals(password) ) return true;
else return false;
}
}
0 Comments:
张贴评论
<< Home