Send As SMS

2004-03-28

webeans demo 3: Database Access

Demo 3: Database Access using Webeans


Use Cases:



  1. Use Case 1: Database Query
  2. Use Case 2: New Record
  3. Use Case 3: Edit Record
  4. Use Case 4: Delete Record

Steps to running this demo:



  1. Build the model as Demo3.java
  2. run use case 1 from http://localhost/webeans/Demo3/queryUser
  3. input and submit, if find a user, it will be displayed
  4. run use case 1 from http://localhost/webeans/Demo3/queryAllUsers
  5. a list will be displayed, each record can be clicked to see the detail information
  6. run use case 2 from http://localhost/webeans/Demo3/addUser
  7. run use case 3 from http://localhost/webeabs/Demo3/editUser
  8. 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