鑷範瀹ょ鐞嗙郴缁燂紝鍩轰簬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鎺㈤拡鐨勫ぇ鏁版嵁鍒嗘瀽绯荤粺

Python-鍩轰簬socket鍜宻elect妯″潡瀹炵幇IO澶氳矾澶嶇敤