没有合适的资源?快使用搜索试试~ 我知道了~
springmvc增删改查

温馨提示
springmvc增删改查,springmvc是企业级用的最多的技术
资源推荐
资源详情
资源评论

















package
com.gc.action;
import
java.util.Map;
import
java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;
public class Login extends SimpleFormController {
private Logger logger = Logger.getLogger(this.getClass().getName());
public Login() {
setCommandClass(User.class);// 向页面的 bind path 里的 command 注类
}
// 覆写
protected ModelAndView onSubmit(Object command, BindException errors)

throws Exception {
User user = (User) command;
Map model = errors.getModel();
model.put("user", user);
setCommandClass(User.class);// 向页面的 bind path 里的 command 注类
return new ModelAndView(getSuccessView(), model);
}
}
package com.gc.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import
javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse;
import
org.springframework.web.servlet.ModelAndVie
w;

import
org.springframework.web.servlet.mvc.multiac
tion.MultiActionController;
public class Operater extends
MultiActionController {
private Logger logger =
Logger.getLogger(this.getClass().getName())
;
private String viewPage;
// 跳转到添加页
public ModelAndView
visitor(HttpServletRequest request,
HttpServletResponse respone) throws
Exception {
System.out.println("--------------
>visitor" + "跳转到添加页");
return new ModelAndView("add", null);
}
public ModelAndView

insert(HttpServletRequest request,
HttpServletResponse respone) throws
Exception {
System.out.println("--------------
>insert" + "新增");
Map model = new HashMap();
model.put("wmh", "wmh");
return new ModelAndView(getViewPage(),
model);
}
// 删除动作
public void delete(HttpServletRequest
request, HttpServletResponse response)
throws Exception {
System.out.println("--------------
>delete" + "删除"
+ request.getParameter("id"));
PrintWriter out = null;
try {
request.setCharacterEncoding("UTF-
8");

response.setContentType("text/html");
response.setCharacterEncoding("UTF-
8");
out = response.getWriter();
} catch (IOException e) {
e.printStackTrace();
}
out.print("<script
type='text/javascript'>" + "alert(' 删 除 成
功');"
+
"window.location.href='operator.do?
action=queryAll';"
+ "</script>");
;
} // 修改动作
public ModelAndView
update(HttpServletRequest request,
HttpServletResponse respone) throws
Exception {
剩余47页未读,继续阅读
资源评论

- 幽蓝阿蒙2013-10-16这个例子还行,值得学习!
- wang_fenghua2015-10-26不错 可以使用 值得学习
- qq25140569802015-08-18我从这个例子中学到了很多
- 猎人-d2013-12-13马马虎虎,最简单的

梦回九龙朝
- 粉丝: 1
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 专升本C语言试卷.docx
- 网络营销策划期末考试试卷及答案.doc
- 君豪贸易电子商务网站解决方案.doc
- 云计算的军事应用初探.docx
- 2023年VisualBasic题库有答案要点.doc
- 青少年网络安全知识.docx
- 模块一-网络营销概述2ppt课件.pptx
- 【推荐】运用文本数据库中元数据关联规则进行知识发现的研究.ppt
- 集团网站专业版集团客户端使用手册.doc
- 网络公司季度工作总结.pptx
- 红塔集团数据库营销系统集成安装用户手册.doc
- 8.软件测试与质量管理.ppt
- 员工亲历微软与Google工作管理资料.pdf
- 算法概述概要.pptx
- 网络化智能家居平台商业计划书.doc
- 制冷系统安全技术操作规程.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
