資料庫:sqlserver2005
伺服器:tomcat6.0
開發工具:myeclipse6.0
採用框架:struts1.2
貼出完整** :
建立sql指令碼:
create table [dbo].[batch](
[id] [int] identity(1,1) not null,
[name] [varchar](50) null,
[password] [varchar](50) null,
constraint [pk_batch] primary key clustered
([id] asc
)with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary]
) on [primary]
go連線資料庫類:
public class dbconnection
return dbc._getconnection();
}public connection _getconnection() throws exception
}採用dao工廠模式:
po類:
public class batch
public void setid(int id)
public string getname()
public void setname(string name)
public string getpassword()
public void setpassword(string password)
}dao介面:
public inte***ce batchdao
實現介面類:
public class batchdaoimpl implements batchdao else
} catch (exception e) finally catch (sqlexception e)
}return list;}}
工廠類:
public class daofactory
}action:繼承dispatchaction
public class batchaction extends dispatchaction
}
C 實現多型的乙個例子
include using namespace std class animal class dog public animal int main 定義了乙個animal類,派生類dog,如果不使用指標或引用,baddog的型別永遠是animal型別,而不會是別的型別。animal baddog d...
乙個struts spring的例子
第乙個struts spring的例子 呵呵剛學spring 寫還望各位大蝦指教!配置struts就不用說了吧,如果用myeclipse直接add一下就可以了.接下來就來配置讓它支援spring 可 一,新建專案後,開啟struts confing.xml在後面加人下面 簡單吧!二然後就開始寫我們的...
乙個sql的例子
select dbo.userinfo.username,dbo.userinfo.usertruename,dbo.userinfo.useremail,dbo.userinfo.usermobile,dbo.userinfo.usertelephone,dbo.userinfo.usercar,...