JavaWeb课程设计 - 图文(5)

2019-08-20 20:22

(2)客户资料修改

public class ACustomerModify {

//修改一个客户信息

public void doRegister( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得要修改的客户详细信息 String sCustomerId = (String)inputData.get(\); String sRealname = (String)inputData.get(\); String sSex = (String)inputData.get(\);

String sBirthday = (String)inputData.get(\); String sPhone = (String)inputData.get(\);

String sCellphone = (String)inputData.get(\); String sAddress = (String)inputData.get(\); String sStartDate = (String)inputData.get(\); String sMemo = (String)inputData.get(\);

//生成一个Customer对象以调用

Customer customer = new Customer(); customer.setCustomerId( sCustomerId ); customer.setRealname( sRealname ); customer.setSex( sSex );

customer.setBirthday( sBirthday );

21

customer.setPhone( sPhone );

customer.setCellphone( sCellphone ); customer.setAddress( sAddress );

customer.setStartDate( sStartDate ); customer.setMemo( sMemo );

//调用对应的logic类 LCustomer lCustomer = (LCustomer)GlobalObjectProvider.getLogicService(CommonConst.LOGIC_KEY_CUSTOMER);

//添加对应的记录

lCustomer.modifyCustomer( customer );

//然后重新检索,并将页面迁移到一览页面

Vector vCustomers = lCustomer.getAllCustomer();

outputData.put( \, CommonConst.VIEWID_CUSTOMER_LIST); //往值域中设置当前位置信息

mySession.setAttribute(\, vCustomers ); outputData.put( \, new Integer(0) ); return; } }

22

(3)客户资料删除

public class ACustomerDelete {

//到首页

public void doFirst( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首页的index一定为0 outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(0) ); return; }

23

//到末页

public void doLast( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得全部客户信息,并计算出最后一页的位置 Vector allCustomers = (Vector)mySession.getAttribute(\); int iMax = allCustomers.size();

int iMaxPage = (int)Math.ceil((double)iMax/20); int iIndex = (iMaxPage-1)*20;

//首页的index一定为0 outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到前页

public void doPrev( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得当前页

String sCurPage = (String)inputData.get(\); int iCurPage = (new Integer(sCurPage)).intValue(); int iIndex = (iCurPage-2)*20; outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到次页

public void doNext( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

24

//首先获得当前页

String sCurPage = (String)inputData.get(\); int iCurPage = (new Integer(sCurPage)).intValue(); int iIndex = iCurPage*20; outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer(iIndex) ); return; }

//到首页

public void doSpec( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception {

//首先获得指定页码

String sSpecPage = (String)inputData.get(\); //获得全部客户信息,并计算出最后一页的位置 Vector allCustomers = (Vector)mySession.getAttribute(\); int iMax = allCustomers.size();

int iMaxPage = (int)Math.ceil((double)iMax/20); int iSpec = (new Integer(sSpecPage)).intValue(); //如果指定页大于全部页码,则跳转到第一页 if ( iSpec > iMaxPage ) {

iSpec = 1; }

//指定页

outputData.put( \, CommonConst.VIEWID_CUSTOMER_DELETE); //往值域中设置当前位置信息

outputData.put( \, new Integer((iSpec-1)*20) ); return; }

//修改某条记录

public void doDelete( Hashtable inputData, Hashtable outputData, HttpSession mySession ) throws Exception

25


JavaWeb课程设计 - 图文(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:电子商务安全实验

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: