鑷範瀹ょ鐞嗙郴缁燂紝鍩轰簬B/S妯″紡涓嬬殑JAVA绯荤粺
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鑷範瀹ょ鐞嗙郴缁燂紝鍩轰簬B/S妯″紡涓嬬殑JAVA绯荤粺相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/message' title='message'>message
null delete 璋冪敤 lips key ESS 鍑虹幇 鏁版嵁搴撶殑鎿嶄綔姣忓ぉ璁板綍瀛︿範锛屾瘡澶╀細鏈夊ソ蹇冩儏銆?^_^*
浠婂ぉ璁板綍鐨勯」鐩槸鑷範瀹ょ鐞嗙郴缁燂紝杩欎釜椤圭洰鏄繖涔堝洖浜嬶細涔犲绠$悊绯荤粺鐨勮璁°€佸紑鍙戝拰娴嬭瘯宸ヤ綔锛岃绯荤粺鍩轰簬B/S缁撴瀯,鍒╃敤鐜版湁鏍″洯涓€鍗¢€氱郴缁?閫氳繃JAVA鍜宮ysql鏁版嵁搴撶瓑杞欢鎶€鏈?瀹炵幇鑷姩鍒嗗彂搴т綅銆侀€夋嫨浜ゆ崲搴т綅銆佸骇浣嶄繚鐣欒秴鏃剁鐞嗗拰鍥惧舰鍔ㄧ敾鏄剧ず搴т綅浣嶇疆鍙婄姸鎬佺瓑鍔熻兘,瑙e喅楂樻牎鍥句功棣嗚嚜涔犲鏅亶鍑虹幇鐨勭敱浜庢姠搴с€佸崰搴ц€屽鑷寸殑搴т綅鍒╃敤鐜囦綆绛夐棶棰樸€傘€?br />鍋氳繖涓」鐩殑鏃跺€欙紝鎴戜滑闇€瑕佺敤鍒?a href="https://www.qwbishe.com/2392.html" target="_blank">SSM(MYECLIPSE)妗嗘灦锛屽紑鍙戝伐鍏烽€夌敤鏈€鎷挎墜鐨凪YECLIPSE銆?br />鑷範瀹ょ鐞嗙郴缁熼」鐩槸涓€涓?鍚庡彴椤圭洰銆?br />寮€鍙戠郴缁熸椂锛岄渶姹傚垎鏋愭槸蹇呬笉鍙皯鐨勪竴涓幆鑺傘€傝嚜涔犲绠$悊绯荤粺鎷ユ湁鐨勭櫥褰曡鑹插寘鎷簡绠$悊鍛樸€佺敤鎴锋敞鍐屻€?br />姣忎釜璐﹀彿璁剧疆韬唤銆佽处鍙枫€佸瘑鐮佹槸蹇呬笉鍙皯鐨勶紝绠$悊鍛樸€佺敤鎴锋敞鍐屼腑閮藉寘鍚繖浜涚櫥褰曡鑹茶鏈夌殑瀛楁銆?/p>
鎬荤粨寰楀嚭璇ョ郴缁熸墍鏈夋暟鎹负锛氱鐞嗗憳(admin)銆佺敤鎴锋敞鍐?yonghuzhuce)銆佸骇浣嶅垎鍙?zuoweifenfa)銆佸骇浣嶄氦鎹?zuoweijiaohuan)
绠$悊鍛樿〃
瀛楁鍚?| 绫诲瀷 | 灞炴€?| 鎻忚堪 id | INT(11) | PRIMARY KEY | 绠$悊鍛榠d username | VARCHAR(255) | | 璐﹀彿 password | VARCHAR(255) | | 瀵嗙爜 quanxian | VARCHAR(255) | | 鏉冮檺
鐢ㄦ埛娉ㄥ唽琛?/p>
瀛楁鍚?| 绫诲瀷 | 灞炴€?| 鎻忚堪 id | INT(11) | PRIMARY KEY | 绠$悊鍛榠d username | VARCHAR(255) | | 璐﹀彿 password | VARCHAR(255) | | 瀵嗙爜 quanxian | VARCHAR(255) | | 鏉冮檺
搴т綅鍒嗗彂琛?/p>
瀛楁鍚?| 绫诲瀷 | 灞炴€?| 鎻忚堪 id | INT(11) | PRIMARY KEY | 搴т綅鍒嗗彂id kongzuoxuanze | VARCHAR(255) | | 绌哄骇閫夋嫨 zuoweitiaozheng | VARCHAR(255) | | 搴т綅璋冩暣 xingming | VARCHAR(255) | | 濮撳悕 zuoweiweizhi | VARCHAR(255) | | 搴т綅浣嶇疆
搴т綅浜ゆ崲琛?/p>
瀛楁鍚?| 绫诲瀷 | 灞炴€?| 鎻忚堪 id | INT(11) | PRIMARY KEY | 搴т綅浜ゆ崲id jiaohuanjia | VARCHAR(255) | | 浜ゆ崲鐢? jiaohuanyi | VARCHAR(255) | | 浜ゆ崲涔? shijian | VARCHAR(255) | | 鏃堕棿 jiayuanweizhi | VARCHAR(255) | | 鐢插師浣嶇疆 yiyuanweizhi | VARCHAR(255) | | 涔欏師浣嶇疆
SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- ---------------------------- -- Table structure for ggzixishiguanlixt -- ---------------------------- DROP TABLE IF EXISTS `t_admin`; CREATE TABLE `t_admin` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 鈥?/span>绠$悊鍛榠d鈥?/span>,`username` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>璐﹀彿鈥?/span>,`password` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>瀵嗙爜鈥?/span>,`quanxian` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>鏉冮檺鈥?/span>,PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=鈥?/span>绠$悊鍛?/span>鈥?/span>; -- ---------------------------- DROP TABLE IF EXISTS `t_yonghuzhuce`; CREATE TABLE `t_yonghuzhuce` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 鈥?/span>鐢ㄦ埛娉ㄥ唽id鈥?/span>,`xingming` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>濮撳悕鈥?/span>,`nianling` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>骞撮緞鈥?/span>,`xingbie` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>鎬у埆鈥?/span>,`zhuanye` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>涓撲笟鈥?/span>,`username` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>璐﹀彿鈥?/span>,`password` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>瀵嗙爜鈥?/span>,PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=鈥?/span>鐢ㄦ埛娉ㄥ唽鈥?/span>; -- ---------------------------- DROP TABLE IF EXISTS `t_zuoweifenfa`; CREATE TABLE `t_zuoweifenfa` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 鈥?/span>搴т綅鍒嗗彂id鈥?/span>,`kongzuoxuanze` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>绌哄骇閫夋嫨鈥?/span>,`zuoweitiaozheng` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>搴т綅璋冩暣鈥?/span>,`xingming` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>濮撳悕鈥?/span>,`zuoweiweizhi` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>搴т綅浣嶇疆鈥?/span>,PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=鈥?/span>搴т綅鍒嗗彂鈥?/span>; -- ---------------------------- DROP TABLE IF EXISTS `t_zuoweijiaohuan`; CREATE TABLE `t_zuoweijiaohuan` (`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 鈥?/span>搴т綅浜ゆ崲id鈥?/span>,`jiaohuanjia` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>浜ゆ崲鐢?/span>鈥?/span>,`jiaohuanyi` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>浜ゆ崲涔?/span>鈥?/span>,`shijian` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>鏃堕棿鈥?/span>,`jiayuanweizhi` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>鐢插師浣嶇疆鈥?/span>,`yiyuanweizhi` VARCHAR(255) DEFAULT NULL COMMENT 鈥?/span>涔欏師浣嶇疆鈥?/span>,PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT=鈥?/span>搴т綅浜ゆ崲鈥?/span>;
娣诲姞搴т綅鍒嗗彂妯″潡锛?/p>
鍦▃uoweifenfaController涓畾涔塼ianjiazuoweifenfaact鎺ユ敹椤甸潰浼犲叆鐨勫骇浣嶅垎鍙戝弬鏁帮紝瀹氫箟涓簔uoweifenfa銆傚叾涓瓃uoweifenfa鍖呭惈瀛楁锛氱┖搴ч€夋嫨,搴т綅璋冩暣,濮撳悕,搴т綅浣嶇疆锛屼娇鐢╰ianjiazuoweifenfaact灏嗚搴т綅鍒嗗彂瀵硅薄瀛樺叆鏁版嵁搴撲腑锛屽湪zuoweifenfaMapper涓畾涔変簡insert鏂规硶锛屽尮閰嶆暟鎹簱涓殑insert into zuoweifenfa璇彞瀹炵幇灏嗗骇浣嶅垎鍙戞暟鎹瓨鍏ユ暟鎹簱鐨勬搷浣溿€傝閮ㄥ垎鏍稿績浠g爜濡備笅锛?/p>
閫氳繃zuoweifenfadao鐨刬nsert鏂规硶灏嗛〉闈紶杈撶殑搴т綅鍒嗗彂娣诲姞鍒版暟鎹簱涓?zuoweifenfadao.insert(zuoweifenfa);
灏嗘坊鍔犲骇浣嶅垎鍙戞垚鍔熶俊鎭紝淇濆瓨鍒皉equest鐨刴essage涓紝鍦ㄩ〉闈腑缁欏嚭鐢ㄦ埛鎻愮ず request.setAttribute("message", "娣诲姞搴т綅鍒嗗彂鎴愬姛");
杩斿洖搴т綅鍒嗗彂绠$悊鐣岄潰
return "forward:/tianjiazuoweifenfa.action";
鏌ヨ搴т綅鍒嗗彂妯″潡锛?/p>
搴т綅鍒嗗彂鐨勬煡璇㈡ā鍧楀疄鐜版柟寮忎负锛屽湪椤甸潰涓彂璧穤uoweifenfaguanli.action璇锋眰銆傞€氳繃璇ヨ姹傦紝鍝嶅簲鏈嶅姟鍣▃uoweifenfaController绫讳腑鐨剒uoweifenfaguanli锛屽湪璇ユ柟娉曚腑閫氳繃selectByexample杩涜鏁版嵁鐨勬煡璇㈡搷浣溿€傚皢鎵€鏈夌殑搴т綅鍒嗗彂淇℃伅鏌ヨ鍚庯紝淇濆瓨鍒皉equest涓殑zuoweifenfaall涓紝鍦ㄩ〉闈腑杩涜灞曠ず锛岃繑鍥瀦uoweifenfaguanli.jsp锛岃閮ㄥ垎鏍稿績浠g爜濡備笅鎵€绀猴細
鐢熸垚搴т綅鍒嗗彂鏍蜂緥绫伙紝閫氳繃example瀹氫箟鏌ヨ鏉′欢 ZuoweifenfaExample example = new ZuoweifenfaExample();
閫氳繃zuoweifenfadao鐨剆electByExample鏂规硶鏌ヨ鍑烘墍鏈夌殑搴т綅鍒嗗彂淇℃伅 List zuoweifenfaall = zuoweifenfadao.selectByExample(example);
灏嗗骇浣嶅垎鍙戜俊鎭紝淇濆瓨鍒皉equest涓紝鍦ㄩ〉闈㈤€氳繃foreach鏂规硶杩涜灞曠ず request.setAttribute("zuoweifenfaall", zuoweifenfaall);
杩斿洖搴т綅鍒嗗彂绠$悊鐣岄潰
return "forward:/zuoweifenfaguanli.action";
淇敼搴т綅鍒嗗彂妯″潡锛?/p>
鍦ㄩ〉闈㈠畬鎴愬骇浣嶅垎鍙戠殑淇敼淇℃伅濉啓鍚庯紝灏嗚閮ㄥ垎鏁版嵁浼犲叆xiugaizuoweifenfa.action鍦板潃锛屽苟閫氳繃post杩涜鎻愪氦銆傛彁浜ゅ悗鍦▃uoweifenfaController涓€氳繃xiugaizuoweifenfa杩涜鎺ユ敹锛屽皢鎵€鏈夊瓧娈靛皝瑁呬负涓€涓骇浣嶅垎鍙戝疄浣撱€傚苟灏嗚瀹炰綋浼犲叆zuoweifenfadao涓殑updateByPrimaryKeySelective鏂规硶涓紝鍦ㄨ鏂规硶涓畾涔変簡閫氳繃搴т綅鍒嗗彂id鏇存柊鍏朵綑搴т綅鍒嗗彂鐨勫瓧娈碉紝璇ラ儴鍒嗗瓧娈靛寘鎷┖搴ч€夋嫨,搴т綅璋冩暣,濮撳悕,搴т綅浣嶇疆锛岃閮ㄥ垎鏍稿績浠g爜濡備笅鎵€绀猴細
閫氳繃zuoweifenfadao鐨勪慨鏀规柟娉曟牴鎹甶d淇敼瀵瑰簲鐨勫骇浣嶅垎鍙?zuoweifenfadao.updateByPrimaryKeySelective(zuoweifenfa);
灏嗕慨鏀瑰骇浣嶅垎鍙戞垚鍔熶俊鎭紝淇濆瓨鍒皉equest鐨刴essage涓紝鍦ㄩ〉闈腑缁欏嚭鐢ㄦ埛鎻愮ず request.setAttribute("message", "淇敼搴т綅鍒嗗彂淇℃伅鎴愬姛");
杩斿洖搴т綅鍒嗗彂绠$悊鐣岄潰
return "forward:/zuoweifenfaguanli.action";
鍒犻櫎搴т綅鍒嗗彂妯″潡锛?/p>
鍦ㄧ鐞嗛〉闈腑锛岀偣鍑诲垹闄ゃ€傞〉闈㈠皢閫氳繃a鏍囩鐨刪ref灞炴€э紝浣跨敤get鏂规硶灏嗚搴т綅鍒嗗彂
鐨刬d涓婁紶鍒版湇鍔″櫒涓紝鍦ㄦ湇鍔″櫒涓€氳繃zuoweifenfaController绫讳腑鐨剆hanchuzuoweifenfa杩涜鎺ユ敹锛屼箣鍚庤皟鐢▃uoweifenfaMapper涓殑deleteByPrimaryKey鏂规硶鏍规嵁ID杩涜鍒犻櫎銆傚皢鍒犻櫎淇℃伅淇濆瓨鍒皉equest鐨刴essage涓紝鍦ㄩ〉闈㈢粰鍑虹敤鎴峰垹闄ゆ垚鍔熺殑鎻愮ず淇℃伅锛岃閮ㄥ垎鏍稿績浠g爜濡備笅锛?/p>
閫氳繃zuoweifenfadao鐨勫垹闄ゆ柟娉曟牴鎹甶d鍒犻櫎瀵瑰簲鐨勫骇浣嶅垎鍙?zuoweifenfadao.deleteByPrimaryKey(id);
灏嗗垹闄ゅ骇浣嶅垎鍙戞垚鍔熶俊鎭紝淇濆瓨鍒皉equest鐨刴essage涓紝鍦ㄩ〉闈腑缁欏嚭鐢ㄦ埛鎻愮ず request.setAttribute("message", "鍒犻櫎搴т綅鍒嗗彂鎴愬姛");
杩斿洖搴т綅鍒嗗彂绠$悊鐣岄潰
return "forward:/zuoweifenfaguanli.action";
以上是关于鑷範瀹ょ鐞嗙郴缁燂紝鍩轰簬B/S妯″紡涓嬬殑JAVA绯荤粺的主要内容,如果未能解决你的问题,请参考以下文章
PHP鍩轰簬MVC妯″紡涓嬬殑鍖栧鍝侀攢鍞綉绔欙紝婧愮爜鍒嗕韩
Spark + Hadoop,鍩轰簬WIFI鎺㈤拡鐨勫ぇ鏁版嵁鍒嗘瀽绯荤粺