这是《Struts开发入门与项目实践》的源代码

源代码在线查看: dep.java

软件大小: 25437 K
上传用户: ADGFS
关键词: Struts 项目 实践 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				package StudyNote;
				
				import java.util.*;
				import java.sql.Connection;
				import java.sql.ResultSet;
				
				public class Dep {  
					private int id = 0;	
					private String name = null;	
					 
					public Dep(){}
					
					public void setId(int id) {
						this.id = id;
					}
					  
					public int getId() {
						return id;
					}
					
					public void setName(String name) {
						this.name = name;
					}
					  
					public String getName() {
						return name;
					}
						
					public static Vector Search(DB db) throws Exception{
						Vector DepList = new Vector();
						ResultSet rs;
				        String strSql=null;
				        strSql = "select * from dep ";
				        	
						rs = db.OpenSql(strSql);
						
						while  (rs.next()){
							Dep dep = new Dep();
							
							dep.setId(rs.getInt("id")) ;
							dep.setName(rs.getString("depname")) ;
							
							DepList.add(dep);
						}
						return DepList;
					}
					
				}			

相关资源