Web應用開發(fā)工程師案例手冊_第1頁
Web應用開發(fā)工程師案例手冊_第2頁
Web應用開發(fā)工程師案例手冊_第3頁
Web應用開發(fā)工程師案例手冊_第4頁
Web應用開發(fā)工程師案例手冊_第5頁
已閱讀5頁,還剩41頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Web應用開發(fā)工程師案例手冊-財務報銷管理系統(tǒng)一、項目需求分析1、項目背景描述某學院的財務部門,現(xiàn)在感覺到本院的財務支出管理有點混亂, 對于個別業(yè)務部門存在任意開支的現(xiàn)象, 所以希望通過網上統(tǒng)一登記 報銷細目的形式,財務主管和院領導可以隨時掌握學院的經費支出情 況。學院的財務形式描述如下:每年學院的國家撥款及各類收入都 按照各個業(yè)務部門的預算,劃成分類的賬號,所有的支出都按照其所 發(fā)生的業(yè)務性質所屬賬號進行報銷。各個賬號有相應的負責人和出 納,有的負責人會有多個賬號的支配權限, 有的出納可以操作多個賬 號,只要業(yè)務相關即可,這些都是由財務主管來分配。用戶已經提供原始表格,一期任務把該表格實現(xiàn)網

2、上填報即可。 財務主管可以看到全院所有的報銷信息,財務助理只能看到自己錄入 的信息。所有的記錄應可以導出Excel表格。2、需求概要分析(1)、用戶和角色權限部分:財務主管維護系統(tǒng)用戶,并為用戶 指定角色,用戶的初始化密碼和證件號相同,各用戶自己登陸后可修 改密碼。角色分為三類: 、出納:可以對自己被授權的賬號進行報銷記錄的維護;、賬號負責人:可以對自己被授權的賬號進行查詢,不能做新增、修改、刪除等操作;清華大學計算機與信息管理中心第2頁、財務主管:可以查詢、維護全院所有賬號的報銷記錄;(2)、報銷記錄維護:填寫報銷記錄時,需要記錄摘要、費用類型、經辦人、所屬賬號、 記錄人、記錄時間、處理方式

3、等信息。參考用戶提供的原始表格。為規(guī)范填寫,費用記錄、處理方式都做標準化處理,財務主管維 護代碼表后,出納錄入時選擇錄入。為避免賬號填寫錯誤,出納錄入時,賬號信息也是選擇方式錄入, 每個出納只能列出自己被授權的賬號。(3)、報銷記錄查詢根據(jù)賬號、費用類型、金額范圍 等字段進行查詢。出納和賬號 負責人只能查詢到自己被授權的賬號的報銷記錄。 財務主管可以看到 所有賬號的報銷記錄。查詢結果最下方,需要對金額字段做匯總。查詢結果應該能導出Excel3、開發(fā)技術參數(shù)數(shù)據(jù)庫采用Oracle;系統(tǒng)架構采用 Struts + Spring + Hibernate ;涉及開發(fā)環(huán)境和工具:JDK1.5 Eclip

4、se (MyEclipse)、Resin3.0.19 (Tomcat5.5以上亦可)、Dreamweaver、Oracle數(shù)據(jù)庫及客戶端;、系統(tǒng)功能設計1、用戶維護只有財務主管才有用戶維護的功能Banner(財務主管)-用戶維護報銷維護賬號授權賬號維護處理方式維護費用類型維護用戶維護 退出新加用戶按鈕修改用戶刪除用戶選擇序號用戶名角色Checkbox 12001230001出納Checkbox 22001580610賬號負責人Checkbox 3說明:1、選中某條記錄,可以進行修改,每次只能修改一條記錄;2、刪除可以批量進行,可以選中多條記錄進行刪除;3、點新加用戶按鈕后,跳轉到下頁的新加用戶

5、界面;新加用戶頁面用戶登陸名:用戶姓名:角色: (select)保存按鈕說明:1、角色的下拉選項有 出納、賬號負責人兩類;2、保存用戶時,應檢測該用戶名是否已經存在,如果存在,則返回本頁面并 給出相應提示;3、用戶名應當是用戶證件號;2、賬號維護新加賬號頁面賬號:賬號名稱:賬號負責人: 賬號狀態(tài): (select)備注:保存按鈕說明:賬號狀態(tài)是指:正常 、關閉兩種狀態(tài)Banner (財務主管)-賬號維護報銷維護賬號授權賬號維護處理方式維護費用類型維護用戶維護 退出新加賬號按鈕修改賬號刪除賬號選擇序號賬號賬號名稱賬號負責人賬號狀態(tài)備注Checkbox11000010001日常辦公賬號張華正常Ch

6、eckbox23000020005學生活動經費李軍正常Checkbox3說明:1、選中某條記錄,可以進行修改,每次只能修改一條記錄;2、刪除可以批量進行,可以選中多條記錄進行刪除;3、點新加用戶按鈕后,跳轉到上頁的新加賬號界面;3、報銷處理方式維護Banner (財務主管)-報銷處理方式維護報銷維護賬號授權賬號維護處理方式維護費用類型維護用戶維護 退出新加處理方式按鈕修改 刪除選擇序號處理方式Checkbox1已領現(xiàn)金Checkbox2已領支票Checkbox3說明:1、選中某條記錄,可以進行修改,每次只能修改一條記錄;2、刪除可以批量進行,可以選中多條記錄進行刪除;3、點新加處理方式按鈕后,

7、跳轉到下頁的新加處理方式界面;新加處理方式頁面處理方式:保存按鈕說明:保存的時候,要檢測該處理方式是否已經存在,如果已經存在,需要返 回本頁并給出提示;4、費用類型維護Banner (財務主管)-費用類型維護報銷維護賬號授權賬號維護處理方式維護費用類型維護選擇序號費用代碼費用類型費用說明新加費用類型按鈕Checkbox101辦公費Checkbox202郵電費Checkbox3用戶維護退出修改 刪除說明:1、選中某條記錄,可以進行修改,每次只能修改一條記錄;2、刪除可以批量進行,可以選中多條記錄進行刪除;3、點新加處理方式按鈕后,跳轉到下頁的新加處理方式界面;新加費用類型費用代碼:費用類型:費用

8、說明:保存按鈕(textarea)說明:1、保存的時候,要檢測該費用類型是否已經存在, 返回本頁并給出提示;2、費用代碼、費用類型、費用說明均為必填項;如果已經存在,需要5、賬號授權Banner (財務主管)-賬號授權報銷維護賬號授權賬號維護 處理方式維護費用類型維護用戶維護 退出新加賬號授權按鈕修改 刪除賬號 授權人 查詢按鈕選擇序號賬號授權人Checkbox11000010001張華Checkbox21000010002李磊說明:1、選中某條記錄,可以進行修改,每次只能修改一條記錄;2、刪除可以批量進行,可以選中多條記錄進行刪除;3、點新加按鈕后,跳轉到下頁的新賬號授權界面;4、點下查詢按

9、鈕后,本頁顯示查詢結果;新建賬號授權頁賬號: (select)授權人: (select)保存說明:1、賬號的下拉框是從賬號表中讀出;2、授權人的下拉框是從用戶表中讀出,顯示用戶的真實姓名,存盤時存用戶的zjh;6、報銷維護頁Banner報銷維護首頁報銷維護賬號授權賬號維護處理方式維護費用類型維護 用戶維護 退出新加修改刪除賬號: (select)金額范圍 至 報銷時間 至費用類型: (select)處理方式: (select)查詢按鈕選擇序號 摘要費用類型處理方式金額經辦人 記錄人報銷時間備注入件.*說明:1、賬號是當前用戶被授權的所有賬號下拉選擇;2、費用類型、處理方式 都是下拉列表;新加報

10、銷記錄頁賬號:(select)摘要:費用類型:(select)報銷時間:3、頁面底部是當頁的金額合計金額:處理方式:(select)經辦人:保存按鈕說明:1、存盤的時候,自動保存當前用戶為錄入人;2、金額框,只能輸入數(shù)值型;三、數(shù)據(jù)庫設計1、報銷明細表Columns IndexesConstraint T riggers DataScripts Gian依 Sinonyrns Partrtions SubpartitiohsStats?Size ReftH /于 r ill Bl11VSIDColumn Nme ID ,F(xiàn)NJ? D 加 TypeDefault -CommentsHistogr

11、ann .ID11NINTEGER|YesZH2YVAR CHAR 2 (10 Bytej賬號YesZY3YVAACHAR2 50 EyteJ摘要YesJE4YNUMBER (2.2)金頷YesBZ5YVARCHAR23QByte)備注YesJBRGYVARCHAR2(10Bvtfr)統(tǒng)辦大Y#sBXSJ7YVARCHARJOOByJte)報銷時間YesJLRaYVAR CHAR 2 (10 Bytej記錄大YesFYLX9YVAACHAA2 20 EyteJ費用類型YesCLFSwYVAR CH AR 2 20 Byte處理方式INoColumns Indexes I Conslraiirt

12、ts T riggers DataScnp 惶 I Giar 惶 Synonym Partitions2、用戶表Column Name ,ID .Fk區(qū)NulP ,Dwta Type,DefaiA Comments ,Histogram ,ID1iMINTEGER用戶ID|VCJ5USERNAME2YVARCHAR2l20evle)用尸登錄名YetPASSWORD3YVARCHAR2P0Gyle)密用YesROLE4YVARCHAR2 |20 Byte)角色YesAEALNAME5YVARCHAR5 Byte)用尸其實姓名YesSubpaiititions Stats/Size Reterei

13、3、費用類型Column Name 一ID Fk Null? Data Tiqpe-Default -Comments /Histograin -ID11NINTEGERIDYesFYLX2YMRCHAR213口 Byte)費用類型YesFYLXSM3YV4RCHAR2 。Byte)費用類型說明Yes4、賬號Column Name1 ,ID ,Pk HNJ? 一Data Type|T口 efaufc -Comments -Histcgiram ,ID11NINTEGERIDYes2H2YVARCHAR2 (10 即時賬號Yej2HF7P3YVARCHAR2 (30 時間滕號負責大Yes2HMC

14、4YVAACHAR2 (50 Byte)喋號名稱YesBZ5YVARCHAR2 (5口 B陽儕注YesZHZT6YVARCHAR2 (W Byte味號狀態(tài)Yes5、賬號授權pDlumn NameIOIFPk一ulP)ala T.ypeTDeladtComirenlsHiitograTjIL1JF-INTEGERDYesZH2YVARCHAR2 (ID Byte)睇號YwUSERNAWE3YAR 2(20 01玻號接權的用戶登錄名Y四、運行結果實例用戶登錄,科記M甘秫 作胃墻折格同冷畢.E IFttlflft悔號w杜方式晚小A量得時H#ABil承Sift30CIOD1.號鴕:”m o己欄機董工而

15、事Kmo?-nr2X11口足蚱部可記工品3ID0ffM黃口卯0巴建克云liB*sxiiao.iffW映tll30CBDD1.際黃zr d巴呵王UH,一203 DOI 4臉蚱3IDD1.n皿o馬抵舊工而隼KKH=c-nrsxiiao.i睡嶼制可 TOC o 1-5 h z *4通立特vWJIIU吟電特A勢 OJJ上4&Uy*住報銷記錄列表郵跡時隨g現(xiàn)就鏟 倒使& stars 用學理型1車號授料卻表2用尸至多名tHH10010QIZOCJM?修芭卅田J0010Q22001003酗蠣IOOIOD?2E1MJ俺淺嶇賬號授權結果導出ExcelfEffieZ,聯(lián)號丘鉗用美國 ffi3. BEE 。索用獎券

16、注4方式卷辦人隼忸明同即人注漫ggiM* d已限酬切平200?=-03-02?TcfiDE1DI11CC2幫主祖王國華1mCDLim:rriME用ratoni曲 It EiiM? I牛業(yè)才弱看內1 ii r口T+IIZ*己力風令LSI,L1力九|m1!刪除之前必須進行詢問與確認察的迷舞后子MH-4Srt=商用T審計開工 后戶W開 IFiiM1+凡壬9號郭物號/向人9狀蠡缶評lt皿回岫軍有,后手41陛】其皿加酒r學宿甲匹竄舄審理砂膽1I101003斗手林-不外吉總置諛迪賬號維護退出報梢記錄賬號援粳賬號維護費用類型處理方式用它營建用戶列表用尸名用尸姓名用戶角色修改如 Q1M1季煮財密主管線刪除20

17、01002張華之n出納n幽刪陵81003陳鑫出納J儂刪除2001004常存口出納二|幽刪除用戶管理退出報銷記錄一號授權,號維護費用類型處理才式用戶莒理靠鋪處理方式推銷處理方式修改n除修改冊賒己他銀行代捷修改冊賒修改理賬幡改刪除己$賤票修改刪除報銷處理方式的維護報精記錄賬號授根一號維護費用類型 處理現(xiàn) 用戶管理退出費用類型費用芟型說明修改餐費修改刪除通信費修比刪除郵電費修諛刪除圖書費修心冊除則試費用類型測試費用類型說明修改陽除費用類型費用類重:則式費用類型費用類型說明:測就費用類型說明費用類型新加修改W|W1費用類型維護五、重點代碼剖析Struts-config.xmlform-bean nam

18、e=zhForm type=.thcic.demo.form.ZhForm清華大學計算機與信息管理中心/第12頁global-exceptions /action-mappings actionattribute=loginForminput=/login.jspname=loginFormpath=/loginscope=requesttype=.thcic.demo.action.LoginActionforward name=loginSuccess path=/bxmx.do?method=list /forward name=loginError path=/error.jsp /a

19、ctionactionattribute=bxmxForminput=/bxmxList.jsp parameter=method name=bxmxForm path=/bxmx scope=requesttype=.thcic.demo.action.BxmxAction forward name=success path=/bxmxList.jsp / /actionactionattribute=zhForm name=zhForm parameter=methodpath=/zhscope=requesttype=.thcic.demo.action.ZhAction forward

20、 name=success path=/zh.jsp / actionattribute=fylxForm input=/fylxAdd.jsp name=fylxForm parameter=method path=/fylx scope=requesttype=.thcic.demo.action.FylxAction forward name=success path=/fylx.jsp / actionattribute=clfsForm input=/clfsadd.jsp name=clfsForm parameter=method path=/clfs scope=request

21、 type=.thcic.demo.action.ClfsAction forward name=success path=/clfs.jsp / /actionactionattribute=zhsqForm input=/zhsq.jsp parameter=method name=zhsqForm path=/zhsq scope=requesttype=.thcic.demo.action.ZhsqAction forward name=success path=/zhsq.jsp / /actionactionattribute=cwUserForm input=/cwUserAdd

22、.jsp name=cwUserForm parameter=methodpath=/cwUserscope=requesttype=.thcic.demo.action.CwUserAction forward name=success path=/user.jsp /message-resourcesparameter=.thcic.demo.ApplicationResources /Web.xmlEncodeFilter.thcic.demo.util.ReqEncodeFilterRequestEncodeGBKEncodeFilter*.doactionorg.apache.str

23、uts.action.ActionServletconfig/WEB-INF/struts-config.xmldebug3detail30action*.doindex.jsp/報銷明細的Actionpackage .thcic.demo.action;import javax.servlet. HYPERLINK http:/http.HttpServletRequest http.HttpServletRequest;import javax.servlet. HYPERLINK http:/http.HttpServletResponse http.HttpServletRespons

24、e;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import org.apache.struts.actions.DispatchAction;import .thcic.demo.bo.BxmxService;import .thcic.demo.bo.ClfsService;import .thcic.demo.bo.FylxService;import .thcic

25、.demo.bo.ZhsqService;import .thcic.demo.form.BxmxForm;import .thcic.demo.vo.Bxmx;import .thcic.demo.vo.CwUser;public class BxmxAction extends DispatchAction /報銷明細的列表form,public ActionForward list(ActionMappingmapping, ActionFormHttpServletRequest request, HttpServletResponseresponse)getListData(requ

26、est);return mapping.findForward(success);/獲得列表需要顯示的數(shù)據(jù)private void getListData(HttpServletRequest request) BxmxService bxmxService = new BxmxService();ZhsqService zhsqService = new ZhsqService();FylxService fylxService = new FylxService();ClfsService clfsService = new ClfsService();CwUser user =(CwUs

27、er)request.getSession().getAttribute(user);/找到當前用戶有權限看到的所有報銷記錄 request.setAttribute(bxmxList,bxmxService.getUserBxmx(user);/找到當前用戶被授權的全部賬號request.setAttribute(zhList, zhsqService.getUserZhList(user);/費用類型列表request.setAttribute(fylxList, fylxService.getAllFylxList();/處理方式列表request.setAttribute(clfsLi

28、st, clfsService.getAllClfsList();/新加報銷明細public ActionForward saveOrUpdate(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)BxmxForm bxmxForm = (BxmxForm)form;/把form里的屬性賦值給mx實體Bxmx mx = new Bxmx();if(bxmxForm.getId() != null & bxmxForm.getId().trim() !=&

29、 bxmxForm.getId().length()0)mx.setId(Long.parseLong(bxmxForm.getId(); mx.setFylx(bxmxForm.getFylx();mx.setJe(Double.parseDouble(bxmxForm.getJe();mx.setBxsj(bxmxForm.getBxsj();mx.setClfs(bxmxForm.getClfs();mx.setBz(bxmxForm.getBz();mx.setJbr(bxmxForm.getJbr();mx.setJlr(CwUser)request.getSession().get

30、Attribute(user). getUsername();mx.setZh(bxmxForm.getZh();mx.setZy(bxmxForm.getZy();new BxmxService().saveOrUpdateClfs(mx);/做好返回數(shù)據(jù)準備this.getListData(request);bxmxForm.reset(mapping, request);return mapping.findForward(success);/刪除報銷明細public ActionForward delete(ActionMapping mapping, ActionForm form,

31、HttpServletRequest request, HttpServletResponse response)BxmxService bxmxService = new BxmxService();String id = request.getParameter(id);Bxmx mx = bxmxService.getBxmxById(id);bxmxService.delBxmx(mx);this.getListData(request);return mapping.findForward(success);/*編輯某條記錄* */response)public ActionForw

32、ard toEdit(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse BxmxForm bxmxForm = (BxmxForm)form;BxmxService bxmxService = new BxmxService();String id = request.getParameter(id);Bxmx mx = bxmxService.getBxmxById(id);bxmxForm.setBxsj(mx.getBxsj();bxmxForm.setBz(mx.

33、getBz();bxmxForm.setClfs(mx.getClfs();bxmxForm.setFylx(mx.getFylx();bxmxForm.setId(String.valueOf(mx.getId(); bxmxForm.setJbr(mx.getJbr();bxmxForm.setJe(String.valueOf(mx.getJe();bxmxForm.setJlr(mx.getJlr();bxmxForm.setZy(mx.getZy();bxmxForm.setZh(mx.getZh();this.getListData(request);return mapping.

34、findForward(success); package .thcic.demo.action;import javax.servlet. HYPERLINK http:/http.HttpServletRequest http.HttpServletRequest;import javax.servlet. HYPERLINK http:/http.HttpServletResponse http.HttpServletResponse;import org.apache.struts.action.ActionForm;import org.apache.struts.action.Ac

35、tionForward;import org.apache.struts.action.ActionMapping;import org.apache.struts.actions.DispatchAction; import .thcic.demo.bo.ClfsService;import .thcic.demo.form.ClfsForm;import .thcic.demo.vo.Clfs;public class ClfsAction extends DispatchAction public ActionForward list(ActionMappingmapping, Acti

36、onForm form,HttpServletRequest request, HttpServletResponse response)ClfsForm clfsForm = (ClfsForm) form;ClfsService clfsService = new ClfsService(); request.setAttribute(clfsList, clfsService.getAllClfsList();return mapping.findForward(success); public ActionForward saveOrUpdate(ActionMapping mappi

37、ng,ActionForm form, HttpServletRequest request, HttpServletResponse response)ClfsForm clfsForm = (ClfsForm) form;ClfsService clfsService = new ClfsService。;Clfs clfs = new Clfs();clfs.setClfs(clfsForm.getClfs();if(clfsForm.getId() != null & clfsForm.getId().trim() !=& clfsForm.getId().length()0)clfs

38、.setId(Long.parseLong(clfsForm.getId();clfsService.saveOrUpdateClfs(clfs);request.setAttribute(clfsList, clfsService.getAllClfsList();clfsForm.reset(mapping, request);return mapping.findForward(success);/*編輯某條記錄* */public ActionForward toEdit(ActionMapping mapping, ActionForm form, HttpServletReques

39、t request, HttpServletResponse response) ClfsForm clfsForm = (ClfsForm) form;ClfsService clfsService = new ClfsService();String id = request.getParameter(id);Clfs clfs = clfsService.getClfsByID(id);clfsForm.setClfs(clfs.getClfs();clfsForm.setId(String.valueOf(clfs.getId();request.setAttribute(clfsLi

40、st, clfsService.getAllClfsList();return mapping.findForward(success);public ActionForward delete(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) ClfsForm clfsForm = (ClfsForm) form;ClfsService clfsService = new ClfsService。;String id = request.getPara

41、meter(id);Clfs clfs = clfsService.getClfsByID(id); clfsService.delClfs(clfs);request.setAttribute(clfsList, clfsService.getAllClfsList();clfsForm.reset(mapping, request); return mapping.findForward(success); package .thcic.demo.action; import javax.servlet. HYPERLINK http:/http.HttpServletRequest ht

42、tp.HttpServletRequest;import javax.servlet. HYPERLINK http:/http.HttpServletResponse http.HttpServletResponse;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import org.apache.struts.actions.DispatchAction;import

43、.thcic.demo.bo.UserService;import .thcic.demo.form.CwUserForm;import .thcic.demo.vo.CwUser;public class CwUserAction extends DispatchAction /用戶列表public ActionForward list(ActionMappingmapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) CwUserForm cwUserForm = (CwUserFo

44、rm) form;UserService userService = new UserService();request.setAttribute(userList, userService.getUserList();return mapping.findForward(success);/新加用戶public ActionForward saveOrUpdate(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) CwUserForm cwUser

45、Form = (CwUserForm) form;UserService userService = new UserService();CwUser user = new CwUser();if(cwUserForm.getId()!= null & cwUserForm.getId().trim()!=& cwUserForm.getId().length()0)user.setId(Long.parseLong(cwUserForm.getId(); user.setUsername(cwUserForm.getUsername(); user.setRealname(cwUserFor

46、m.getRealname(); user.setRole(cwUserForm.getRole();userService.saveOrUpdate(user);request.setAttribute(userList, userService.getUserList();cwUserForm.reset(mapping, request);return mapping.findForward(success); /*編輯某條記錄* */public ActionForward toEdit(ActionMapping mapping, ActionFormform, HttpServle

47、tRequest request, HttpServletResponseCwUserForm cwUserForm = (CwUserForm) form;UserService userService = new UserService();String id = request.getParameter(id);CwUser user = userService.getUserById(id);cwUserForm.setUsername(user.getUsername(); cwUserForm.setRealname(user.getRealname(); cwUserForm.s

48、etRole(user.getRole();request.setAttribute(userList, userService.getUserList();return mapping.findForward(success);/刪除用戶public ActionForward delete(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse CwUserForm cwUserForm = (CwUserForm) form;UserService userService

49、 = new UserService();String id = request.getParameter(id);CwUser user = userService.getUserById(id); userService.delUser(user);response)response)request.setAttribute(userList,userService.getUserList();cwUserForm.reset(mapping, request);return mapping.findForward(success); package .thcic.demo.action;

50、import javax.servlet. HYPERLINK http:/http.HttpServletRequest http.HttpServletRequest;import javax.servlet. HYPERLINK http:/http.HttpServletResponse http.HttpServletResponse;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.Actio

51、nMapping;import org.apache.struts.actions.DispatchAction;import .thcic.demo.bo.FylxService;import .thcic.demo.form.FylxForm;import .thcic.demo.vo.Fylx;public class FylxAction extends DispatchAction public ActionForward list(ActionMappingmapping, ActionForm form,HttpServletRequest request, HttpServle

52、tResponse response)FylxForm fylxForm = (FylxForm) form;getFylxList(request);return mapping.findForward(success);private void getFylxList(HttpServletRequest request) /獲得所有費用類型的列表FylxService fylxService = new FylxService();request.setAttribute(fylxList,fylxService.getAllFylxList();public ActionForward

53、 saveOrUpdate(ActionMapping mapping,ActionForm form, HttpServletRequest request, HttpServletResponse response)FylxForm fylxForm = (FylxForm) form;Fylx fylx = new Fylx();if(fylxForm.getId() != null & fylxForm.getId().trim() !=& fylxForm.getId().length()0)fylx.setId(Long.parseLong(fylxForm.getId();fyl

54、x.setFylx(fylxForm.getFylx();fylx.setFylxsm(fylxForm.getFylxsm();FylxService fylxService = new FylxService();fylxService.saveOrUpdate(fylx);getFylxList(request);return mapping.findForward(success); public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpSe

55、rvletResponse response) FylxForm fylxForm = (FylxForm) form;FylxService fylxService = new FylxService();String id = request.getParameter(id);Fylx fylx = fylxService.getFylxById(id);fylxService.delFylx(fylx);getFylxList(request);return mapping.findForward(success);/*編輯某條記錄* */public ActionForward toE

56、dit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)FylxForm fylxForm = (FylxForm) form;FylxService fylxService = new FylxService();String id = request.getParameter(id);Fylx fylx = fylxService.getFylxByld(id);fylxForm.setFylx(fylx.getFylx();fylxForm.s

57、etFylxsm(fylx.getFylxsm();fylxForm.setId(String.valueOf(fylx.getId();getFylxList(request);return mapping.findForward(success);package .thcic.demo.action;import javax.servlet. HYPERLINK http:/http.HttpServletRequest http.HttpServletRequest;import javax.servlet. HYPERLINK http:/http.HttpServletRespons

58、e http.HttpServletResponse;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import .thcic.demo.bo.UserService;import .thcic.demo.form.LoginForm; import .thcic.demo.vo.CwUser;p

59、ublic class LoginAction extends Action public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) LoginForm loginForm = (LoginForm) form;UserService userService = new UserService();/ 構造VO實體CwUser user = new CwUser();user.setUsername(

60、loginForm.getUsername();package .thcic.demo.action;import javax.servlet. HYPERLINK http:/http.HttpServletRequest http.HttpServletRequest;import javax.servlet. HYPERLINK http:/http.HttpServletResponse http.HttpServletResponse;import org.apache.struts.action.ActionForm;import org.apache.struts.action.

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論