forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeaLoader.java
More file actions
74 lines (62 loc) · 2.36 KB
/
TeaLoader.java
File metadata and controls
74 lines (62 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.spring.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
import com.hibernate.dao.DAOSupport;
import com.hibernate.model.DocuTeaInfo;
public class TeaLoader extends MultiActionController {
private DAOSupport dao;
public ModelAndView reg(HttpServletRequest req, HttpServletResponse res) {
List list = dao.QueryObject("from SystemSpecialtyCode");
Map model = new HashMap();
model.put("list", list);
return new ModelAndView("/docuview/doc_tea_info_reg", model);
}
public ModelAndView service(HttpServletRequest req, HttpServletResponse res) {
String teaId = req.getParameter("teaId");
System.out.println("teaId:" + teaId);
if (teaId == null) {
List list = dao.QueryObject("from DocuTeaInfo");
Map model = new HashMap();
model.put("list", list);
return new ModelAndView("/docuview/teaDocuService", model);
} else {
List list = dao.QueryObject("from DocuTeaInfo where teaId=" + teaId);
DocuTeaInfo doc = (DocuTeaInfo) list.get(0);
list = dao.QueryObject("from SystemSpecialtyCode");
Map model = new HashMap();
model.put("doc", doc);
model.put("list", list);
return new ModelAndView("/docuview/teaDocuModify", model);
}
}
public ModelAndView search(HttpServletRequest req, HttpServletResponse res) {
String condition = req.getParameter("condition");
String conditionContent = req.getParameter("conditionContent");
if (condition.equals("ÐÕÃû")) {
condition = "name";
} else if (condition.equals("Éí·ÝÖ¤")) {
condition = "sfzh";
} else {
condition = "teaId";
}
List list = dao.QueryObject("from DocuTeaInfo where "+condition+" like '"+conditionContent+"%'");
Map model = new HashMap();
model.put("list", list);
return new ModelAndView("/docuview/teaDocuService", model);
}
public DAOSupport getDao() {
return dao;
}
public void setDao(DAOSupport dao) {
this.dao = dao;
}
protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse res) throws Exception {
req.setCharacterEncoding("gbk");
return super.handleRequestInternal(req, res);
}
}