webeans demo 3: Database Access
Demo 3: Database Access using Webeans
Use Cases:
- Use Case 1: Database Query
- Use Case 2: New Record
- Use Case 3: Edit Record
- Use Case 4: Delete Record
Steps to running this demo:
- Build the model as Demo3.java
- run use case 1 from http://localhost/webeans/Demo3/queryUser
- input and submit, if find a user, it will be displayed
- run use case 1 from http://localhost/webeans/Demo3/queryAllUsers
- a list will be displayed, each record can be clicked to see the detail information
- run use case 2 from http://localhost/webeans/Demo3/addUser
- run use case 3 from http://localhost/webeabs/Demo3/editUser
- run use case 4 from http://localhost/webeans/Demo3/deleteUser
Features to be improve:
- The Model bean
Demo3.java:
// metadata is not appended, do it your self
public class User {
private String userName;
private String password;
private String email;
private String address;
private String telephone;
}
public class Demo3 {
public User query(String userName){
// ... do it yourself
}
public User queryUserByEmail(String email){ /* do it your self */ }
public Collection queryAllUsers(){ /* */ }
public void addUser(User user){ ... }
public void updateUser(User user){ .... }
public void deleteUser(User user){ .... }
}
0 Comments:
张贴评论
<< Home