- 浏览: 564504 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (411)
- webservice (3)
- oracle (37)
- sqlserver (8)
- j2ee (56)
- linux (7)
- javaweb (47)
- office (1)
- struts (23)
- hibernate (11)
- spring (29)
- 网络 (2)
- tomcat (13)
- tongweb (0)
- weblogic (0)
- powerdesiginer (3)
- svn (3)
- js (20)
- ie (2)
- 编译 (3)
- css (2)
- 操作系统 (5)
- Android (41)
- jbpm4.3 (1)
- fckeditor (3)
- 操作excel (2)
- db2常用命令 (1)
- ibatis (5)
- mysql (16)
- 表达式语言 (1)
- java方式调用存储过程 (1)
- ca (1)
- linux客户端 (1)
- 电子数码 (1)
- 行业应用 (12)
- 开发工具 (4)
- 面试 (1)
- 计算机原理 (1)
- NOSQL (5)
- 虚拟机 (1)
- nginx (0)
- velocity (2)
- jndi (1)
- spring mvc (39)
- springmvc (32)
- 安全 (5)
- htmleditor (6)
- iphone4 (1)
- html (4)
- jstl (2)
- ckeditor (5)
- 连接池 (1)
- jquery (6)
- 分页 (1)
- 技术研发规则 (1)
- javamail (1)
- maven (2)
- upload (1)
- log (1)
- 测试 (10)
- spring roo (1)
- 版本控制 (2)
- find bugs (0)
- jsf (0)
- springroo (0)
- 小道理 (1)
- 小道理,技术标准 (1)
- jsf (0)
- bitbao (2)
- redmine (3)
- 团队意识 (1)
- mybatis (2)
- jquery mobile (1)
- flexpaper (0)
- json (4)
- URLRewriteFilte (1)
- html5 (1)
- 都乐保活动 (0)
- openfire (0)
- TreeMap (1)
- build (0)
- javaweb,tag (0)
- algorithm (1)
- tag (2)
- 扯淡 (0)
- mac (2)
- 叶一火(老一) (1)
- 游玩 (1)
- 编码 (1)
- 上线部署 (0)
- 研发管理 (0)
- thumbnailator (2)
- 旅游 (0)
- bingweibo (1)
- 杂谈 (4)
- ktv (1)
- weibo (1)
- 爱情 (2)
- 饮食 (1)
- MediaWiki (1)
- git (1)
- 版本库 (1)
- servlet (1)
- 感悟 (1)
- 人生 (1)
- highcharts (1)
- poi (0)
- websphere (0)
- php (1)
最新评论
-
woshixushigang:
good
org.springframework.beans.TypeMismatchException: Failed to convert property valu -
nathanleewei:
org.springframework.jdbc.core.B ...
org.springframework.beans.TypeMismatchException: Failed to convert property valu -
浪禾木:
请问是ckeditor\contents.css吗?改过以后 ...
ckeditor自动换行问题 -
simusuishi:
刚哥威武!
ckeditor取值赋值问题 -
a455642158:
收割完毕……
Android开源项目源码下载(不断更新中)
收藏列表
- 全部 [27]
- 默认 [10]
- spring [1]
- json [1]
- j2ee [1]
- 汉字转拼音 [1]
- 在线人数统计 [1]
- q我吧 [1]
- xmlapi [7]
- beantomaputil [1]
- build.sh [1]
- js方式去掉空格 [1]
- 系统-日志 报表 [1]
标题 | 标签 | 来源 | |
ibm项目 irmp 日志 系统统计 新方式 | |||
package com.ibm.banking.irmp.web.log; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.lang3.time.DateUtils; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.labels.ItemLabelAnchor; import org.jfree.chart.labels.ItemLabelPosition; import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.ui.TextAnchor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import com.google.gson.Gson; import com.ibm.banking.framework.dto.PagedQueryResult; import com.ibm.banking.framework.web.SearchListBaseController; import com.ibm.banking.irmp.app.App; import com.ibm.banking.irmp.app.AppService; import com.ibm.banking.irmp.log.Log; import com.ibm.banking.irmp.log.LogQueryParam; import com.ibm.banking.irmp.log.LogService; import com.ibm.banking.irmp.refdata.RefDataService; import com.ibm.banking.irmp.util.JFreeChartUtil; import com.ibm.banking.irmp.web.log.model.LogHighChartsVO; @Controller @RequestMapping("/log") public class LogListController extends SearchListBaseController<Log, LogQueryParam> { @Autowired LogService logService; @Autowired RefDataService refDataService; @Autowired AppService appService; @Override protected PagedQueryResult<Log> searchData(LogQueryParam queryParam) { return logService.selectLogList(queryParam); } @Override protected void refData(Model model) { model.addAttribute("priorityMap", refDataService.getRefBeanMapByCategory("PRIORITY")); model.addAttribute("apps", appService.getActiveApp()); } @Override protected String getListViewName() { return "logList.tile"; } @RequestMapping("/let") public String let(@ModelAttribute("queryParam") LogQueryParam queryParam, Model model) { Date now = new Date(); now = DateUtils.round(now, Calendar.DAY_OF_MONTH); queryParam.setBeginDate(DateUtils.addDays(now, -30)); queryParam.setEndDate(now); refData(model); return "/log/logLet.jsp"; } /* * 生成安全审计统计分析图标的方法 */ @Deprecated @RequestMapping("/chart") public void chart(@ModelAttribute("queryObject") LogQueryParam queryParam, HttpServletRequest request, HttpServletResponse response, Model model) { HttpSession session = request.getSession(); @SuppressWarnings("unchecked") List<Object[]> list = (List<Object[]>) session .getAttribute("logStatistics"); Map<String, String> priorityMap = refDataService .getRefBeanMapByCategory("PRIORITY"); // 创建类别图(Category)数据对象 DefaultCategoryDataset dataset = new DefaultCategoryDataset(); if (list != null && list.size() > 0) { for (Object[] objs : list) { for (int i = 0; i < objs.length; i++) { dataset.addValue( Integer.valueOf(objs[2] == null ? "0" : objs[2] + ""), priorityMap.get(objs[1]) + "", objs[0] + ""); } } } model.addAttribute("hasData", Boolean.TRUE); JFreeChart chart = ChartFactory.createBarChart("安全审计统计分析结果", "", "日志数量", dataset, PlotOrientation.VERTICAL, true, true, true); BarRenderer renderer = new BarRenderer(); CategoryPlot plot = chart.getCategoryPlot(); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setUpperMargin(0.2); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); ItemLabelPosition itemLabelPosition = new ItemLabelPosition( ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT, TextAnchor.HALF_ASCENT_LEFT, -1.57D); renderer.setBasePositiveItemLabelPosition(itemLabelPosition); renderer.setBaseNegativeItemLabelPosition(itemLabelPosition); JFreeChartUtil.generate(plot, renderer); JFreeChartUtil.configFont(chart, true); if (queryParam.getSubsys() != null) { JFreeChartUtil.exportJpg(chart, response, 4800, 500); } else { JFreeChartUtil.exportJpg(chart, response, 1200, 500); } session.removeAttribute("logStatistics"); } /** * 当用户在页面点击”统计分析“按钮时触发该方法 * * @author xushigang * @param queryParam * @param request * @param model * @return */ @RequestMapping("/statistic") public String statistic( @ModelAttribute("queryObject") LogQueryParam queryParam, HttpServletRequest request, Model model) { List<Object[]> list; List<String> xAxis = new ArrayList<String>(); List<App> listApp = appService.getActiveApp(); Map<String, String> logLevelMap = refDataService.getRefBeanMapByCategory("PRIORITY"); if (log.isDebugEnabled()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // log.debug("日志统计查询参数 beginDate:" + // sdf.format(queryParam.getBeginDate())); // log.debug("日志统计查询参数 endDate:" + // sdf.format(queryParam.getEndDate())); log.debug("日志统计查询参数 subsys:" + queryParam.getSubsys()); log.debug("日志统计查询参数 subsys条件:" + (queryParam.getSubsys() != null)); log.debug("日志统计查询参数 priority:" + queryParam.getPriority()); log.debug("日志统计查询参数 priority条件:" + (queryParam.getPriority() != null && queryParam .getPriority().length() > 0)); log.debug("日志统计查询参数 userId:" + queryParam.getUserId()); log.debug("日志统计查询参数 userId条件:" + (queryParam.getUserId() != null && queryParam.getUserId() .length() > 0)); } if (queryParam.getSubsys() != null) { // 当使用安全审计统计分析功能的时候, 如果用户在查询页面中子系统项选择“所有”时, // 统计图标显示的结果为“按照子系统模块”进行查询 list = logService.selectOrg(queryParam); for (Object[] org : list) { if(!xAxis.contains(String.valueOf(org[1]))) { xAxis.add(String.valueOf(org[1])); } } } else { // 否则按照“分行和组织”进行查询 list = logService.selectSubBranch(queryParam); for (int i = 0; i < listApp.size(); i++) { xAxis.add(listApp.get(i).getAppName()); } } LogHighChartsVO[] vos = new LogHighChartsVO[logLevelMap.size()]; int idx = 0; for(String levelCode : logLevelMap.keySet()){ vos[idx] = new LogHighChartsVO(); vos[idx].setData(new Number[xAxis.size()]); vos[idx++].setName(logLevelMap.get(levelCode)); } for(idx = 0; idx < xAxis.size(); idx++){ for (int j = 0; j < logLevelMap.size(); j++){ Number num = (Number) (list.get(idx * logLevelMap.size() + j)[3]==null? 0:list.get(idx * logLevelMap.size() + j)[3]); vos[j].getData()[idx] = num; if(num.intValue()!=0){ model.addAttribute("hasData", Boolean.TRUE); } } } Gson gson = new Gson(); model.addAttribute("xJson", gson.toJson(xAxis)); model.addAttribute("yJson", gson.toJson(vos)); return "log.statistic.tile"; } } |
|||
ibm 中国银行总行项目 | 系统-日志 报表 | 采用类似对数据分页方式,前提是数据规整 | |
package com.ibm.banking.irmp.web.log; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.labels.ItemLabelAnchor; import org.jfree.chart.labels.ItemLabelPosition; import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.ui.TextAnchor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import com.google.gson.Gson; import com.ibm.banking.framework.dto.PagedQueryResult; import com.ibm.banking.framework.web.SearchListBaseController; import com.ibm.banking.irmp.app.AppService; import com.ibm.banking.irmp.log.Log; import com.ibm.banking.irmp.log.LogQueryParam; import com.ibm.banking.irmp.log.LogService; import com.ibm.banking.irmp.refdata.RefDataService; import com.ibm.banking.irmp.util.JFreeChartUtil; import com.ibm.banking.irmp.web.log.model.LogHighChartsVO; @Controller @RequestMapping("/log") public class LogListController extends SearchListBaseController<Log, LogQueryParam> { @Autowired LogService logService; @Autowired RefDataService refDataService; @Autowired AppService appService; @Override protected PagedQueryResult<Log> searchData(LogQueryParam queryParam) { return logService.selectLogList(queryParam); } @Override protected void refData(Model model) { model.addAttribute("priorityMap", refDataService.getRefBeanMapByCategory("PRIORITY")); model.addAttribute("apps", appService.getActiveApp()); } @Override protected String getListViewName() { return "logList.tile"; } @RequestMapping("/let") public String let(@ModelAttribute("queryParam") LogQueryParam queryParam, Model model) { Date now = new Date(); now = DateUtils.round(now, Calendar.DAY_OF_MONTH); queryParam.setBeginDate(DateUtils.addDays(now, -30)); queryParam.setEndDate(now); refData(model); return "/log/logLet.jsp"; } /* * 生成安全审计统计分析图标的方法 */ @Deprecated @RequestMapping("/chart") public void chart(@ModelAttribute("queryObject") LogQueryParam queryParam, HttpServletRequest request, HttpServletResponse response, Model model) { HttpSession session = request.getSession(); @SuppressWarnings("unchecked") List<Object[]> list = (List<Object[]>) session .getAttribute("logStatistics"); Map<String, String> priorityMap = refDataService .getRefBeanMapByCategory("PRIORITY"); // 创建类别图(Category)数据对象 DefaultCategoryDataset dataset = new DefaultCategoryDataset(); if (list != null && list.size() > 0) { for (Object[] objs : list) { for (int i = 0; i < objs.length; i++) { dataset.addValue( Integer.valueOf(objs[2] == null ? "0" : objs[2] + ""), priorityMap.get(objs[1]) + "", objs[0] + ""); } } } model.addAttribute("hasData", Boolean.TRUE); JFreeChart chart = ChartFactory.createBarChart("安全审计统计分析结果", "", "日志数量", dataset, PlotOrientation.VERTICAL, true, true, true); BarRenderer renderer = new BarRenderer(); CategoryPlot plot = chart.getCategoryPlot(); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setUpperMargin(0.2); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); ItemLabelPosition itemLabelPosition = new ItemLabelPosition( ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT, TextAnchor.HALF_ASCENT_LEFT, -1.57D); renderer.setBasePositiveItemLabelPosition(itemLabelPosition); renderer.setBaseNegativeItemLabelPosition(itemLabelPosition); JFreeChartUtil.generate(plot, renderer); JFreeChartUtil.configFont(chart, true); if (queryParam.getSubsys() != null) { JFreeChartUtil.exportJpg(chart, response, 4800, 500); } else { JFreeChartUtil.exportJpg(chart, response, 1200, 500); } session.removeAttribute("logStatistics"); } /** * 当用户在页面点击”统计分析“按钮时触发该方法 * * @author xushigang * @param queryParam * @param request * @param model * @return */ @RequestMapping("/statistic") public String statistic( @ModelAttribute("queryObject") LogQueryParam queryParam, HttpServletRequest request, Model model) { List<Object[]> list; if (log.isDebugEnabled()) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // log.debug("日志统计查询参数 beginDate:" + // sdf.format(queryParam.getBeginDate())); // log.debug("日志统计查询参数 endDate:" + // sdf.format(queryParam.getEndDate())); log.debug("日志统计查询参数 subsys:" + queryParam.getSubsys()); log.debug("日志统计查询参数 subsys条件:" + (queryParam.getSubsys() != null)); log.debug("日志统计查询参数 priority:" + queryParam.getPriority()); log.debug("日志统计查询参数 priority条件:" + (queryParam.getPriority() != null && queryParam .getPriority().length() > 0)); log.debug("日志统计查询参数 userId:" + queryParam.getUserId()); log.debug("日志统计查询参数 userId条件:" + (queryParam.getUserId() != null && queryParam.getUserId() .length() > 0)); } if (queryParam.getSubsys() != null) { // 当使用安全审计统计分析功能的时候, 如果用户在查询页面中子系统项选择“所有”时, // 统计图标显示的结果为“按照子系统模块”进行查询 list = logService.selectOrg(queryParam); } else { // 否则按照“分行和组织”进行查询 list = logService.selectSubBranch(queryParam); } //refDataService.getRefBeanMapByCategory("PRIORITY"); //appService.getActiveApp(); List<String> xAxis = new ArrayList<String>(); List<Integer> level = new ArrayList<Integer>(); int[] yAxis = new int[list.size()]; ArrayList<LogHighChartsVO> levelDataList = new ArrayList<LogHighChartsVO>(); if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { xAxis.add(list.get(i)[0].toString() == null ? "" : list.get(i)[0].toString()); Integer num = Integer.valueOf(null == list.get(i)[2] || StringUtils.isEmpty(list.get(i)[2].toString()) ? "0" : list.get(i)[2] + ""); //if(level.contains(o)) level.add(Integer.valueOf(String.valueOf(list.get(i)[1]))); yAxis[i] = num.intValue(); if (num.intValue() != 0) { model.addAttribute("hasData", Boolean.TRUE); } } } for (int i = 0; i < level.size(); i++) { LogHighChartsVO vo = new LogHighChartsVO(); int levelParse = Integer.valueOf(String.valueOf(level.toArray()[i])); vo.setName(levelParse==2?"高":levelParse==1?"中":levelParse==0?"低":""); List<Integer> ylist = new ArrayList<Integer>(); for (int y : yAxis) { ylist.add(y); } vo.setData(ylist.subList(i * xAxis.size(), (i + 1) * xAxis.size()) .toArray()); levelDataList.add(vo); } Gson gson = new Gson(); model.addAttribute("xJson", gson.toJson(xAxis)); model.addAttribute("yJson", gson.toJson(levelDataList)); return "log.statistic.tile"; } } |
|||
零散的小知识 | j2ee | ||
package com.bitbao.cm.test.home; import java.io.File; import java.io.IOException; import java.net.URLEncoder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.coobird.thumbnailator.Thumbnails; import org.apache.log4j.Logger; import org.codehaus.jackson.map.ObjectMapper; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.XmlWebApplicationContext; import sun.misc.BASE64Encoder; import co.common.util.StringUtils; import com.bitbao.cm.app.feedback.Subject; import com.bitbao.cm.common.LogNew; import com.bitbao.cm.common.utils.DateUtil; import com.bitbao.cm.common.utils.StringUtil; public class DateTest { private static final Logger logger = Logger.getLogger(DateTest.class); public static void main(String[] args) throws NoSuchAlgorithmException, IOException { // System.out.println(Integer.toHexString(("http://www.bitbao.com".hashCode()))); // System.out.println(Integer.toHexString(("1".hashCode()))); String[] arr={"a","b","c"}; List l = Arrays.asList(arr); //这个ArrayList是Arrays的内部类,可不要看成是java.util.ArrayList,从方法来看只是一个只读的数组,并没有扩展add等添加的方法,那么我刚才调用的add实际上是AbstractList中的add方法,代码一目了然了 l.add("d"); Collection<Integer> collection = new ArrayList<Integer>(Arrays.asList(1,2,3,4,5)); Integer[] moreIntegers = {6,7,8,9}; collection.addAll(Arrays.asList(moreIntegers)); Collections.addAll(collection,11,12,13,14,15); Collections.addAll(collection,moreIntegers); System.out.println(collection); List<Integer> list3 = Arrays.asList(16,17,18); list3.set(1, 99); System.out.println(list3); List<Integer> list4 = new ArrayList<Integer>(); list4.add(33); list4.set(0, 99); System.out.println(list4); ObjectMapper mapper2 = new ObjectMapper(); List<String> list = new ArrayList<String>(); list.add("a"); list.add("b"); list.add("c"); System.out.println(mapper2.writeValueAsString(list));; String htmlStr = "支持版主 谢拉 HTTPs://欢迎光临看 看,支持版主谢拉http://欢迎光临看看。。。! "; String patternString = "(HTTP|http)(s|S)?://[^,, ]+"; Pattern pattern = Pattern.compile (patternString); Matcher matcher = pattern.matcher(htmlStr); String mache = ""; while(matcher.find ()) { int start = matcher.start(); int end = matcher.end(); mache = htmlStr.substring(start,end); System.out.println(mache+"======"); } int[] i = new int[]{23,44,33,1,2,3,6}; Arrays.sort(i); for (int j : i) { System.out.println(j); } Integer com = null; if(!StringUtil.isNullString(com)&&com == -1){} System.out.println(WebApplicationContext.class.getName()); System.out.println(XmlWebApplicationContext.class.getName()); ObjectMapper mapper = new ObjectMapper(); try { System.out.println(mapper.writeValueAsString("42173919,3953927258&fm=52&gp=0.jpg")); } catch (Exception e) { LogNew.error("Exception to serialize object as json string",e); } System.out.println(URLEncoder.encode("[{\"uid\":\"-1\",\"uname\":\"公开\"}]")); final String[] allowtype = new String[] {".jpg",".jpeg",".gif",".bmp",".png"}; for (String type : allowtype) { System.out.println("--asd"); for (String a : allowtype) { if(a.equalsIgnoreCase(".gif")) { break; } System.out.println("-++++-"); } } new File("/Users/xushigang/Desktop/IMG_2063.PNG").renameTo(new File("/Users/xushigang/Desktop/IMG_2063.PNG")); simple(); File f = new File("/Users/xushigang/Desktop/xu"); f.mkdirs(); Long now = System.currentTimeMillis(); System.out.println(now); java.util.Date dt = new java.util.Date(now); System.out.println(DateUtil.dateToString(dt, DateUtil.DATE_YYYYMMDD_HHMMSS)+now); System.out.println(File.separator); String name = " "; if(!StringUtil.isNullString(name)&&StringUtil.isNullString(name.trim())) { System.out.println("adsf"); } //System.out.println(AppProvinceAndCity.provinces.get(2).getValue()); String[] idArr = StringUtils.split("CUSTOMER_PWD", "_OR_"); //String[] idArr = "CUSTOMER_PWD".split("_OR_"); for(String str1 : idArr){ System.out.println(str1); } //System.out.println(null+""); Subject input = new Subject(); if (StringUtils.hasLength(input.getContent())&&input.getContent().length() > 200) { System.out.println("sss"); } Map<Integer, String> map = new HashMap<Integer, String>(); map.put(1, "1"); map.put(1, "2"); map.put(1, "3"); System.out.println(map.get(1).length()); Calendar c = Calendar.getInstance(); c.setTime(new Date()); System.out.println(c.getTime()); LogNew.debug("ddd------------------"); logger.info("info=========wocaini"); logger.warn("info=========wocaini"); Random rand = new Random(System.nanoTime()); System.out.println(rand.toString().getBytes()); MessageDigest digest = MessageDigest.getInstance("SHA"); System.out.println(digest.digest()); digest.update(rand.toString().getBytes()); String tokenValue = (new BASE64Encoder()) .encodeBuffer((digest.digest())); // do again rand = new Random(System.nanoTime()); digest.reset(); digest.update(rand.toString().getBytes()); // Connect token string tokenValue += (new BASE64Encoder()).encodeBuffer((digest.digest())); tokenValue = tokenValue.replaceAll("[\n\r]", ""); System.out.println(tokenValue); // System.out.println(StringUtil.isNullString(0)); // ArrayList<ListItem> INSURANCE_COMPANY = AppConstant.INSURANCE_COMPANY; // for (int i = 0; i < INSURANCE_COMPANY.size(); i++) { //// System.out.println(INSURANCE_COMPANY.get(i).getKey()); // if(INSURANCE_COMPANY.get(i).getKey()==4) // { // INSURANCE_COMPANY.get(i).getValue(); // System.out.println(INSURANCE_COMPANY.get(i).getValue()); // } // } // String aa = null; // String bb = ""; // String cc = " "; // System.out.println(StringUtils.hasLength(aa)); // System.out.println(StringUtils.hasLength(bb)); // System.out.println(StringUtils.hasLength(cc)); // /*if(bb.trim().length()<0||aa.trim().length()>0) // { // System.out.println(true); // }*/ // System.out.println(Math.max(1, 2)); /*Calendar ccc = Calendar.getInstance(); System.out.println(ccc.get(Calendar.DAY_OF_WEEK)); System.out.println(Calendar.DAY_OF_WEEK); System.out.println(Calendar.WEDNESDAY);*/ // System.out.println(AppConstant.INSURANCE_COMPANY.get(index).getKey()); /*DateUtil.stringToDate("00:00", "HH:mm"); System.out.println(DateUtil.stringToDate(" 00: 00", "hh:mm")); String a = ""; if(a==""); System.out.println("11"); System.out.println("22"); System.out.println(Integer.valueOf("")); System.out.println(0x0002|0x0004);*/ /*List<AccountUser> list = new ArrayList<AccountUser>(); AccountUser u = new AccountUser(); u.setName("aa1"); list.add(u); AccountUser u2 = new AccountUser(); u2.setName("aa2"); list.add(u2); System.out.println(list.subList(2, list.size())); for (AccountUser user : list) { user.setName("vv1"); } for (AccountUser user2 : list) { System.out.println(user2.getName()); } String name = null; try { System.out.println(name.length()>0); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }*/ /*System.out.println(filterHtml("<ul><li><u><em><strong>撒旦发生的</strong></em></u></li></ul>")); System.out.println(HtmlUtils.htmlEscape("<ul><li><u><em><strong>撒旦发生的</strong></em></u></li></ul>"));*/ //if((strTemp.charCodeAt(i)>=0)&&(strTemp.charCodeAt(i)<=255)){ 测试 String strTemp = "1111111111111111111111111111111111111111"; int sum = 0; /*for (int j = 0; j < strTemp.length(); j++) { if((strTemp.charAt(j)>=0)&&(strTemp.charAt(j)<=255)){ System.out.println(strTemp.charAt(j)); n++; System.out.println(n+"--"); } }*/ /*for (int j = 1; j <= strTemp.length(); j++) { if((strTemp.charAt(j)>=0)&&(strTemp.charAt(j)<=255)){ sum=sum+1; } else{ sum=sum+2; } if(sum>14){ String str=strTemp.substring(0,j); System.out.println(str); System.out.println(j); break; }else{ System.out.println("已经输入"+sum); } } long ba = new Long("1316342460000"); //---------------测试状态 int status = 6; if((status&2)==2) { System.out.println("已发送"); if((status&4)==4) { System.out.println("已回复"); } }*/ } public static String aa(int aa) { switch(aa) { case 3: System.out.println("a1a"); return "a1a"; case 2: System.out.println("a2a"); return "a2a"; case 1: System.out.println("a3a"); return "a3a"; } return null; } //System.out.println(strTemp.length()); //System.out.println(n+"++++"); public static String filterHtml(String str) { String regxpForHtml = "<([^>]*)>"; // 过滤所有以<开头以>结尾的标签 Pattern pattern = Pattern.compile(regxpForHtml); Matcher matcher = pattern.matcher(str); StringBuffer sb = new StringBuffer(); boolean result1 = matcher.find(); while (result1) { matcher.appendReplacement(sb, ""); result1 = matcher.find(); } matcher.appendTail(sb); return sb.toString(); } /** * * @throws IOException * @brief 生成缩略图简单实例 * */ public static void simple() throws IOException{ //需要转换的文件为桌面上的1.png Thumbnails.of("/Users/xushigang/Desktop/QQ20120608-1.png") /* * forceSize,size和scale必须且只能调用一个 */ // .forceSize(400, 400) //生成的图片一定为400*400 /* * 若图片横比200小,高比300小,不变 * 若图片横比200小,高比300大,高缩小到300,图片比例不变 * 若图片横比200大,高比300小,横缩小到200,图片比例不变 * 若图片横比200大,高比300大,图片按比例缩小,横为200或高为300 */ //.size(200, 300) //.outputFormat("png") //生成图片的格式为png //.outputQuality(0.8f) //生成质量为80% .scale(0.5f) //缩小50% //输出到桌面5文件 .toFile("/Users/xushigang/Desktop/22.PNG"); } public void fun(int n,float m){}; public void fun(int n,int m){}; } |
|||
解析新鲜事短链接 | 比特宝 | ||
/** * 通用的翻译新鲜事短连接方法 * @param content * @param list * @return */ private String translateWeiboUrl(String content, List<String> list) { String output = ""; String patternString = "(HTTP|http)(s|S)?://[^,, ]+"; Pattern emotionPattern = Pattern.compile(patternString); Matcher matcher = emotionPattern.matcher(content); int s = 0, e = 0; while (matcher.find()) { s = matcher.start(); if (s > 0 && e == 0) { output += content.substring(0, s); } else if (s > 0 && s > e) { output += content.substring(e, s); } e = matcher.end(); String sourceLink = content.substring(s, e); MultiValueMap<String, String> tinyUrlParam = new LinkedMultiValueMap<String, String>(); tinyUrlParam.add("longurl", sourceLink); tinyUrlParam.add("authcode", "%^T&*UJY*(J&U"); String tinyResult = sourceLink; try { tinyResult = restTemplate.postForObject("http://91ez.cn", tinyUrlParam, String.class); ModelMap modelMap = JsonUtil.unserializeObject(tinyResult, ModelMap.class); String shortLink = String.valueOf(modelMap.get("tiny_url")); list.add(sourceLink); output += shortLink; } catch (RestClientException e1) { output+=sourceLink; } } if (e + 1 <= content.length()) { output += content.substring(e); } return output; } |
|||
汉字转拼音 | 汉字转拼音 | ||
以下是汉字转拼音程序: 注:需要pinyin4j-2.5.0.jar,其他版本也可以。 一、手工方式。 import net.sourceforge.pinyin4j.PinyinHelper; import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType; import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; /** * @author Administrator 将中文转换成拼音 */ public class CnToPinyin { public CnToPinyin() { } // 将汉字转换为全拼 public static String getPingYin(String src) { char[] t1 = null; t1 = src.toCharArray(); String[] t2 = new String[t1.length]; HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat(); t3.setCaseType(HanyuPinyinCaseType.LOWERCASE); t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE); t3.setVCharType(HanyuPinyinVCharType.WITH_V); String t4 = ""; int t0 = t1.length; try { for (int i = 0; i < t0; i++) { // 判断是否为汉字字符 if (java.lang.Character.toString(t1[i]).matches("[\\u4E00-\\u9FA5]+")) { t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3); t4 += t2[0]; } else t4 += java.lang.Character.toString(t1[i]); } // System.out.println(t4); return t4; } catch (BadHanyuPinyinOutputFormatCombination e1) { e1.printStackTrace(); } return t4; } // 返回中文的首字母 public static String getPinYinHeadChar(String str) { String convert = ""; for (int j = 0; j < str.length(); j++) { char word = str.charAt(j); String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word); if (pinyinArray != null) { convert += pinyinArray[0].charAt(0); } else { convert += word; } } return convert; } // 将字符串转移为ASCII码 public static String getCnASCII(String cnStr) { StringBuffer strBuf = new StringBuffer(); byte[] bGBK = cnStr.getBytes(); for (int i = 0; i < bGBK.length; i++) { // System.out.println(Integer.toHexString(bGBK[i]&0xff)); strBuf.append(Integer.toHexString(bGBK[i] & 0xff)); } return strBuf.toString(); } /** * @param args */ public static void main(String[] args) { // System.out.println(getPinYinHeadChar("太平养老")); // System.out.println(getCnASCII("太平养老")); System.out.println(getPingYin("太平人寿保险有限公司 ")); System.out.println(getPingYin("太平养老 ")); System.out.println(getPingYin("人保寿险 ")); System.out.println(getPingYin("国寿养老 ")); System.out.println(getPingYin("长江养老 ")); System.out.println(getPingYin("泰康养老 ")); } } 目前要转换多种公司,可通过UE把所有保险公司名称编辑成getPingYin(" ")形式, 按ALT+C,选中左侧一列并输入getPingYin来构造输出语句。 如果想构造多行插入语句,扔可以采用UE来构造insert into从而实现批量插入目的。 二、打成jar包方式: 以上代码结合poi组件操作excel,将内容转成拼音再输出到新的excel也可。最后将代码打成jar包,双击可以直接操作当前目录下得excel。 三、根据构建好的表,浅析排序方式: 数据量不大的时候两者效率几乎相同。 select * from temp_table order by pinyin 耗时:0.031 select * from temp_table order by CONVERT(pinyin USING gbk ) COLLATE gbk_chinese_ci 耗时:0.032 |
|||
js 类似tirm 函数 | js方式去掉空格 | http://www.jb51.net/article/16250.htm | |
<input type="text" name="mytxt" value=" 12345678 " /> <input type="button" name="cmd1" onclick="mytxt2.value=mytxt.value.trim()" value="去两边的空格"/> <input type="text" name="mytxt2"/> <input type="button" name="cmd1" onclick="mytxt3.value=mytxt.value.ltrim()" value="去左边的空格"/> <input type="text" name="mytxt3"/> <input type="button" name="cmd1" onclick="mytxt4.value=mytxt.value.rtrim()" value="去右边的空格"/> <input type="text" name="mytxt4"/> <script language="javascript"> String.prototype.trim=function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); } String.prototype.ltrim=function(){ return this.replace(/(^\s*)/g,""); } String.prototype.rtrim=function(){ return this.replace(/(\s*$)/g,""); } </script> 详细出处参考:http://www.jb51.net/article/16250.htm |
|||
获取联系人json(bean to json) | |||
private String getContractJson(String duid, String isOpen) { if ("1".equals(isOpen)) { List<LinkedHashMap<String, String>> targetUserList = JsonUtil.unserializeObject(duid, List.class); if (targetUserList == null) { targetUserList = new ArrayList<LinkedHashMap<String, String>>(); } LinkedHashMap<String, String> openVO = new LinkedHashMap<String, String>(); openVO.put("uid", "-1"); openVO.put("uname", "公开"); targetUserList.add(openVO); duid = JsonUtil.serializeObject(targetUserList); } return duid; } |
|||
抽取方法的例子 | |||
/** * Get repository id for comparing cookie */ private List<String> getInsuIdFromCookie(Cookie[] cookies) { // process compare cookie if (cookies == null) { return null; } List<String> idCookieList = new ArrayList<String>(); for (Cookie myCookie : cookies) { if (myCookie.getName() != null && myCookie.getName().indexOf("insu_id") != -1) { LogHelper.info("==Insurance repository id cookie:" + myCookie.getName()); idCookieList.add(myCookie.getValue()); } } return idCookieList; } /** * Get condition map */ @SuppressWarnings("unchecked") private Map<String, String> getConditionParameters(HttpServletRequest request) { Map<String, String> condMap = new HashMap<String, String>(); Enumeration<String> pEnum = request.getParameterNames(); while (pEnum.hasMoreElements()) { String paramName = pEnum.nextElement(); if (paramName.indexOf("cond") != -1) { condMap.put(paramName, request.getParameter(paramName)); } } Map<String, String> treeMap =new TreeMap<String, String>(condMap); return treeMap; } /** * Get parameter names */ private String getParameters(Set<String> paramSet) { StringBuffer paramBuffer = new StringBuffer(64); if (paramSet != null && paramSet.size() > 0) { for (String paramName : paramSet) { paramBuffer.append(paramName).append(","); } } return paramBuffer.toString(); } @ModelAttribute("title") public String setPageTitle(){ return WebApplicationUtil.getPageTitle("insu_repository"); } |
|||
build.sh | build.sh | 本博客 | |
#!/bin/sh cd ~/update unzip testSource.zip echo "解压成功,按任意键继续" read ANSWER cd bitbao_web rm -rfv .gitignore rm -rfv .settings rm -rfv conf rm -rfv cron rm -rfv src rm -rfv test rm -rfv WebContent/WEB-INF/lib rm -rfv WebContent/META-INF/*.properties rm -rfv WebContent/WEB-INF/staticfile rm -rfv WebContent/WEB-INF/classes/com/bitbao/cm/conf/*.properties echo "已经删除配置文件,按任意键继续" read ANSWER cp -av /home/bit/update/bitbao_web/WebContent/* /home/bit/local/tomcat/webapps/ROOT/ echo "复制代码成功,按任意键继续" read ANSWER sudo /home/bit/local/tomcat/bin/shutdown.sh sudo rm -rfv /home/bit/local/tomcat/work/Catalina/localhost/_/ echo "清除缓存成功,停止所有脚本" read ANSWER sh /home/bit/cron_kill_circle.sh echo "重新启动服务" read ANSWER sudo /home/bit/local/tomcat/bin/startup.sh sh /home/bit/cron_circle.sh tail -f /home/bit/local/tomcat/logs/catalina.out |
|||
DateUtil | |||
package com.ex1; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import com.sun.jmx.snmp.Timestamp; public class CalendarEx { public static void main(String[] args) { goDateToString(); goStringToDate(); goLongToDate(); goLongToString(); goTimeStampToLong(); goTimeStampToDate(); goTimeStampToString(); goDateToTimeStamp(); goDateToLong(); goStringToTimeStamp(); goLongToTimeStamp(); goCalendarToTimeStamp(); goTimeStampToCalendar(); } /** * 13 */ private static void goDateToLong() { System.out.print("13:"); Date d=new Date(); Long time=d.getTime(); System.out.println(time); } /** * 1 */ private static void goCalendarToTimeStamp() { System.out.print("1:"); Calendar c=Calendar.getInstance(); Date date=c.getTime(); Long time=date.getTime(); Timestamp stamp=new Timestamp(time); System.out.println(stamp); } /** * 2 */ private static void goTimeStampToString() { System.out.print("2:"); Timestamp stamp=new Timestamp(); SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String str=format.format(stamp.getDateTime()); System.out.println(str); } /** * 3 */ private static void goLongToTimeStamp() { System.out.print("3:"); Long now=System.currentTimeMillis(); Timestamp stamp=new Timestamp(now); System.out.println(stamp); } /** * 4 */ private static void goStringToTimeStamp() { System.out.print("4:"); String str="2011-9-26 15:30:30"; //Long time=Date.parse(str);//此方法已经过期 DateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); try { Date date=format.parse(str); Long time=date.getTime(); Timestamp stamp=new Timestamp(time); System.out.println(stamp); } catch (ParseException e) { e.printStackTrace(); } } /** * 5 */ private static void goDateToTimeStamp() { System.out.print("5:"); Date d=new Date(); Long time=d.getTime(); Timestamp stamp=new Timestamp(time); System.out.println(stamp); } /** * 6 */ private static void goTimeStampToDate() { System.out.print("6:"); Timestamp stamp=new Timestamp(); long now=stamp.getDateTime(); System.out.println(new Date(now)); } /** * 7 */ private static void goTimeStampToLong() { System.out.print("7:"); Timestamp stamp=new Timestamp(); long now=stamp.getDateTime(); System.out.println(now); } /** * 8 */ private static void goLongToString() { System.out.print("8:"); Long now=System.currentTimeMillis(); Date date=new Date(now); SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String str=format.format(date); System.out.println(str); /** * 直接转换为字符串,但是无法满足日期格式。 */ String s=String.valueOf(now); //now.toString(); System.out.println(s); } /** * 9 */ private static void goLongToDate() { System.out.print("9:"); Long now=System.currentTimeMillis(); Date d=new Date(now); System.out.println(d); } /** * 10 */ private static void goDateToString(){ System.out.print("10:"); Date date=new Date(); SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String str=format.format(date.getTime()); System.out.println(str); } /** * 11 */ private static void goStringToDate(){ System.out.print("11:"); String str="2011-9-26 15:30:30"; DateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); try { Date date=format.parse(str); System.out.println(date); } catch (ParseException e) { e.printStackTrace(); } } /** * 12 */ private static void goTimeStampToCalendar() { System.out.print("12:"); Timestamp stamp=new Timestamp(); Date date=stamp.getDate(); System.out.println(date); } } |
|||
jsonUtil | json | ||
import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.math.BigDecimal; import java.math.BigInteger; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class JsonUtil { private static Log log = LogFactory.getLog(JsonUtil.class); public static String object2json(Object obj) { StringBuilder json = new StringBuilder(); if (obj == null) { json.append("\"\""); } else if (obj instanceof String || obj instanceof Integer || obj instanceof Float || obj instanceof Boolean || obj instanceof Short || obj instanceof Double || obj instanceof Long || obj instanceof BigDecimal || obj instanceof BigInteger || obj instanceof Byte) { json.append("\"").append(string2json(obj.toString())).append("\""); } else if (obj instanceof Object[]) { json.append(array2json((Object[]) obj)); } else if (obj instanceof List) { json.append(list2json((List<?>) obj)); } else if (obj instanceof Map) { json.append(map2json((Map<?, ?>) obj)); } else if (obj instanceof Set) { json.append(set2json((Set<?>) obj)); } else { json.append(bean2json(obj)); } return json.toString(); } public static String bean2json(Object bean) { StringBuilder json = new StringBuilder(); json.append("{"); PropertyDescriptor[] props = null; try { props = Introspector.getBeanInfo(bean.getClass(), Object.class) .getPropertyDescriptors(); } catch (IntrospectionException e) { } if (props != null) { for (int i = 0; i < props.length; i++) { try { String name = object2json(props[i].getName()); String value = object2json(props[i].getReadMethod().invoke( bean)); json.append(name); json.append(":"); json.append(value); json.append(","); } catch (Exception e) { } } json.setCharAt(json.length() - 1, '}'); } else { json.append("}"); } return json.toString(); } public static String list2json(List<?> list) { StringBuilder json = new StringBuilder(); json.append("["); if (list != null && list.size() > 0) { for (Object obj : list) { json.append(object2json(obj)); json.append(","); } json.setCharAt(json.length() - 1, ']'); } else { json.append("]"); } return json.toString(); } public static String array2json(Object[] array) { StringBuilder json = new StringBuilder(); json.append("["); if (array != null && array.length > 0) { for (Object obj : array) { json.append(object2json(obj)); json.append(","); } json.setCharAt(json.length() - 1, ']'); } else { json.append("]"); } return json.toString(); } public static String map2json(Map<?, ?> map) { StringBuilder json = new StringBuilder(); json.append("{"); if (map != null && map.size() > 0) { for (Object key : map.keySet()) { json.append(object2json(key)); json.append(":"); json.append(object2json(map.get(key))); json.append(","); } json.setCharAt(json.length() - 1, '}'); } else { json.append("}"); } return json.toString(); } public static String set2json(Set<?> set) { StringBuilder json = new StringBuilder(); json.append("["); if (set != null && set.size() > 0) { for (Object obj : set) { json.append(object2json(obj)); json.append(","); } json.setCharAt(json.length() - 1, ']'); } else { json.append("]"); } return json.toString(); } public static String string2json(String s) { if (s == null) return ""; StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); switch (ch) { case '"': sb.append("\\\""); break; case '\\': sb.append("\\\\"); break; case '\b': sb.append("\\b"); break; case '\f': sb.append("\\f"); break; case '\n': sb.append("\\n"); break; case '\r': sb.append("\\r"); break; case '\t': sb.append("\\t"); break; case '/': sb.append("\\/"); break; default: if (ch >= '\u0000' && ch <= '\u001F') { String ss = Integer.toHexString(ch); sb.append("\\u"); for (int k = 0; k < 4 - ss.length(); k++) { sb.append('0'); } sb.append(ss.toUpperCase()); } else { sb.append(ch); } } } return sb.toString(); } } |
|||
都乐保公司,联系我们用到的百度地图api | 联系我们 | ||
<!--content--> <style type="text/css"> .iw_poi_title {color:#CC5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap} .iw_poi_content {font:12px arial,sans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap:break-word} </style> <script type="text/javascript"> function initialize() { var map = new BMap.Map('map'); map.centerAndZoom(new BMap.Point(116.458335, 39.912149), 18);//坐标点,缩放比例18 map.addControl(new BMap.NavigationControl());//开启缩放和移动控制控件 map.enableScrollWheelZoom();//允许鼠标滚轮缩放 //开启缩略图,默认打开 var ctrl_ove = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:1}); map.addControl(ctrl_ove); //标注点数组 var markerArr = [{title:"北京都乐保信息技术有限公司,华彬大厦2007",content:"北京市朝阳区建国门外永安东里8号华彬国际大厦2007",point:"116.458335|39.912149",isOpen:0,icon:{w:21,h:21,l:0,t:0,x:6,lb:5}} ]; //创建marker function addMarker(){ for(var i=0;i<markerArr.length;i++){ var json = markerArr[i]; var p0 = json.point.split("|")[0]; var p1 = json.point.split("|")[1]; var point = new BMap.Point(p0,p1); var iconImg = createIcon(json.icon); var marker = new BMap.Marker(point,{icon:iconImg}); var iw = createInfoWindow(i); var label = new BMap.Label(json.title,{"offset":new BMap.Size(json.icon.lb-json.icon.x+10,-20)}); marker.setLabel(label); map.addOverlay(marker); label.setStyle({ borderColor:"#808080", color:"#333", cursor:"pointer" }); (function(){ var index = i; var _iw = createInfoWindow(i); var _marker = marker; _marker.addEventListener("click",function(){ this.openInfoWindow(_iw); }); _iw.addEventListener("open",function(){ _marker.getLabel().hide(); }) _iw.addEventListener("close",function(){ _marker.getLabel().show(); }) label.addEventListener("click",function(){ _marker.openInfoWindow(_iw); }) if(!!json.isOpen){ label.hide(); _marker.openInfoWindow(_iw); } })() } } //创建InfoWindow function createInfoWindow(i){ var json = markerArr[i]; var iw = new BMap.InfoWindow("<b class='iw_poi_title' title='" + json.title + "'>" + json.title + "</b><div class='iw_poi_content'>"+json.content+"</div>"); return iw; } //创建一个Icon function createIcon(json){ var icon = new BMap.Icon("http://openapi.baidu.com/map/images/us_mk_icon.png", new BMap.Size(json.w,json.h),{imageOffset: new BMap.Size(-json.l,-json.t),infoWindowOffset:new BMap.Size(json.lb+5,1),offset:new BMap.Size(json.x,json.h)}) return icon; } addMarker();//开启标记 } function loadScript() { var script = document.createElement("script"); script.src = "http://api.map.baidu.com/api?v=1.2&callback=initialize"; document.body.appendChild(script); } window.onload = loadScript; </script> <div id="content"> <!--side_nav--> <ul id="side_nav"> <li><a href="<spring:url value="/aboutus/productService" />">产品服务</a></li> <li><a href="<spring:url value="/aboutus"/>">关于我们</a></li> <li><a href="<spring:message code="blog.system.url"/>/jobs.html" title="加入我们" target="_blank">加入我们</a></li> <li class="on">联系我们</li> </ul> <!--side_nav end--> <div class="bor_1 p15 fl w713 lh24"> <ul> <li class="pl60 lh50"> <i class="icon_service_phone"></i> 用户服务热线:4006-248-226 </li> <li class="pl60 lh50"> <i class="icon_service_mail"></i> 用户服务邮箱:kefu@bitbao.net </li> </ul> <h3 class="fs14 mt10">日常联系</h3> <div class="pl60"> <table cellpadding="0" cellspacing="0" border="0"> <tbody> <tr> <td width="300">总 机:86-10-8528 9185</td> <td>Tel:86-10-8528 9185</td> </tr> <tr> <td>传 真:86-10-8528 8616</td> <td>Fax:86-10-8528 8616</td> </tr> </tbody> </table> </div> <h3 class="fs14 mt20">公司地址</h3> <div class="pl60 lh24"> 北京市朝阳区建国门外永安东里8号 华彬国际大厦2007 邮编:100022<br /> Room 2007, Reignwood Centre, No.8, Yong'andongli, Jianguomenwai, Chaoyang District, 100022 Beijing<br /> <div id="map" style="width:575px;height:329px;margin-left:0;"></div> </div> </div> </div> <!--content end--> |
|||
BeanToMapUtil | beantomaputil | ||
package com.bitbao.cm.common.utils; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; public class BeanToMapUtil { /** * 将一个 Map 对象转化为一个 JavaBean * @param type 要转化的类型 * @param map 包含属性值的 map * @return 转化出来的 JavaBean 对象 * @throws IntrospectionException * 如果分析类属性失败 * @throws IllegalAccessException * 如果实例化 JavaBean 失败 * @throws InstantiationException * 如果实例化 JavaBean 失败 * @throws InvocationTargetException * 如果调用属性的 setter 方法失败 */ public static Object convertMap(Class type, Map map) throws IntrospectionException, IllegalAccessException, InstantiationException, InvocationTargetException { BeanInfo beanInfo = Introspector.getBeanInfo(type); // 获取类属性 Object obj = type.newInstance(); // 创建 JavaBean 对象 // 给 JavaBean 对象的属性赋值 PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i< propertyDescriptors.length; i++) { PropertyDescriptor descriptor = propertyDescriptors[i]; String propertyName = descriptor.getName(); if (map.containsKey(propertyName)) { // 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。 try { Object value = map.get(propertyName); Object[] args = new Object[1]; args[0] = value; descriptor.getWriteMethod().invoke(obj, args); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block //e.printStackTrace(); } } } return obj; } /** * 将一个 JavaBean 对象转化为一个 Map * @param bean 要转化的JavaBean 对象 * @return 转化出来的 Map 对象 * @throws IntrospectionException 如果分析类属性失败 * @throws IllegalAccessException 如果实例化 JavaBean 失败 * @throws InvocationTargetException 如果调用属性的 setter 方法失败 */ public static Map convertBean(Object bean) throws IntrospectionException, IllegalAccessException, InvocationTargetException { Class type = bean.getClass(); Map<String, Object> returnMap = new HashMap<String, Object>(); BeanInfo beanInfo = Introspector.getBeanInfo(type); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i< propertyDescriptors.length; i++) { PropertyDescriptor descriptor = propertyDescriptors[i]; String propertyName = descriptor.getName(); if (!propertyName.equals("class")) { Method readMethod = descriptor.getReadMethod(); Object result = readMethod.invoke(bean, new Object[0]); if (result != null) { returnMap.put(propertyName, result); } else { returnMap.put(propertyName, ""); } } } return returnMap; } } |
|||
ret.beforeFirst(); | spring | ||
/** * api专用 * * @author: xu * @Class: NewsDao.java * @project: bitbao * @created: 2011/12/18 20:16 * */ public List<NewsInfo> getLatestList(String attribute, String value, String attributeType, int count, Date publishtime) { List<NewsInfo> listNews = new ArrayList<NewsInfo>(); if (StringUtils.isEmpty(attributeType)) { return listNews; } // 查询表名称 String newsTable = AppConstant.DATABASE_SCHEMA_APP_BB_APP + "." + AppConstant.DATABASE_TABLE_BB_NEWS; MapSqlParameterSource paramSource = new MapSqlParameterSource(); String sql = "select id, type, publishtime, url, publishstatus,content, title, createtime, updatetime, picturename, comefrom from " + newsTable + " where delstatus = 0 and publishstatus=2 "; String ab = ""; if (!StringUtils.isEmpty(attribute)) { // 属性不为空 if (attributeType.equals("string")) { // String 类型 有单引号 ab = " and " + attribute + " = '" + value + "'"; } else if (attributeType.equals("int")) { // int类型没有单引号 ab = " and " + attribute + " = " + value; } } sql = sql + ab + " and publishtime>:publishtime and publishtime<=:endtime order by publishtime desc limit " + count; paramSource.addValue("endtime", DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss")); paramSource.addValue("publishtime", DateUtil.dateToString(publishtime, "yyyy-MM-dd HH:mm")); // 从结果集中获取数据 try { SqlRowSet ret = this.namedJdbcTemplate.queryForRowSet(sql, paramSource); // ResourceBundle bundle = // PropertyResourceBundle.getBundle("config"); // String url = bundle.getString("appUrl"); // 根据key得到value // ThreadLocal<HttpServletRequest> request = new // ThreadLocal<HttpServletRequest>(); // String path = request.get().getContextPath(); // String url = // request.get().getScheme()+"://"+request.get().getServerName()+":"+request.get().getServerPort()+path+"/"; ret.beforeFirst(); /* CodeFilter cf = new CodeFilter(); */ while (ret.next()) { // HashMap<String, Object> result = new HashMap<String, // Object>(); NewsInfo _newsInfo = new NewsInfo(); _newsInfo.setNews_col_id(ret.getString("type")); // type id _newsInfo.setNews_id(ret.getString("id")); // id _newsInfo.setNews_title(ret.getString("title")); // 标题 _newsInfo.setNews_author(ret.getString("comefrom")); // 来源 _newsInfo.setNews_time(ret.getString("publishtime")); // 发布时间 // 用创建时间替换 _newsInfo.setNews_subtitle(ret.getString("title")); // 主题? _newsInfo.setNews_image(ret.getString("url")); // 图片地址? _newsInfo.setNews_thumbnail(getNewUrl(AppConstant.NEWSTHUMBNAIL, ret.getString("url"))); // ??? _newsInfo.setNews_digest(getNewUrl(AppConstant.NEWSDIGEST, ret.getString("url"))); _newsInfo.setNews_content(CodeFilter.change(ret.getString("content") == null ? "" : ret.getString("content"))); // 内容 listNews.add(_newsInfo); } } catch (Exception e) { e.printStackTrace(); } return listNews; } |
|||
生成tokenValue, 用两次的SHA的字符串相加最终的tokenValue | http://woshixushigang.iteye.com/ | ||
/** * 生成tokenValue, 用两次的SHA的字符串相加最终的tokenValue * */ public String generateTokenValue() throws NoSuchAlgorithmException { Random rand = new Random(System.nanoTime()); MessageDigest digest = MessageDigest.getInstance("SHA"); digest.update(rand.toString().getBytes()); String tokenValue = (new BASE64Encoder()) .encodeBuffer((digest.digest())); // do again rand = new Random(System.nanoTime()); digest.reset(); digest.update(rand.toString().getBytes()); // Connect token string tokenValue += (new BASE64Encoder()).encodeBuffer((digest.digest())); tokenValue = tokenValue.replaceAll("[\n\r]", ""); return tokenValue; } |
|||
struts-config.xml | xmlapi | ||
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <!-- This is the Struts configuration file for the example application, using the proposed new syntax. NOTE: You would only flesh out the details in the "form-bean" declarations if you had a generator tool that used them to create the corresponding Java classes for you. Otherwise, you would need only the "form-bean" element itself, with the corresponding "name" and "type" attributes. --> <struts-config> <!-- ========== Form Bean Definitions Modify By lianglonglong begin 2006-3-13=================================== --> <form-beans> <form-bean name="WebsiteForm" type="com.futuresoftware.ccmbam.actionform.WebsiteActionForm" /> <form-bean name="ColumninfoForm" type="com.futuresoftware.ccmbam.actionform.ColumninfoActionForm" /> <form-bean name="ContentForm" type="com.futuresoftware.ccmbam.actionform.ContentActionForm" /> <form-bean name="ContentTypeForm" type="com.futuresoftware.ccmbam.actionform.ContenttypeActionForm" /> <form-bean name="TemplateForm" type="com.futuresoftware.ccmbam.actionform.TemplateActionForm" /> <form-bean name="FucdefineForm" type="com.futuresoftware.ccmbam.actionform.FucdefineActionForm" /> <form-bean name="AccountForm" type="com.futuresoftware.ccmbam.actionform.AccountActionForm" /> <form-bean name="CmsuserForm" type="com.futuresoftware.ccmbam.actionform.CmsuserActionForm" /> <form-bean name="DepartmentForm" type="com.futuresoftware.ccmbam.actionform.DepartmentActionForm" /> <form-bean name="DeptroleForm" type="com.futuresoftware.ccmbam.actionform.DeptroleActionForm" /> <form-bean name="FlowdefineForm" type="com.futuresoftware.ccmbam.actionform.FlowdefineActionForm" /> <form-bean name="FlowtaskForm" type="com.futuresoftware.ccmbam.actionform.FlowtaskActionForm" /> <form-bean name="RoleForm" type="com.futuresoftware.ccmbam.actionform.RoleActionForm" /> <form-bean name="RolefucpermForm" type="com.futuresoftware.ccmbam.actionform.RolefucpermActionForm" /> <form-bean name="uploadForm" type="com.futuresoftware.ccmbam.webupload.UploadForm" /> <form-bean name="StatistForm" type="com.futuresoftware.ccmbam.actionform.StatistActionForm" /> <form-bean name="RomoteForm" type="com.futuresoftware.ccmbam.actionform.GetremoteForm" /> <form-bean name="VoteForm" type="com.futuresoftware.ccmbam.actionform.VoteActionForm" /> <form-bean name="LetterForm" type="com.futuresoftware.ccmbam.actionform.LetterActionForm" /> <form-bean name="FiletypeForm" type="com.futuresoftware.ccmbam.actionform.GovfiletypeActionForm" /> <form-bean name="CallingForm" type="com.futuresoftware.ccmbam.actionform.GovfileunitcallingActionForm" /> <form-bean name="wenzhongForm" type="com.futuresoftware.ccmbam.actionform.GovfilewenzhongForm" /> <form-bean name="filecontentForm" type="com.futuresoftware.ccmbam.actionform.GovfilecontentactionForm" /> <!--form-bean name="plancontentForm" type="com.futuresoftware.ccmbam.actionform.PlancontentactionForm"></form-bean> --> <form-bean name="sxzbtypeForm" type="com.futuresoftware.ccmbam.actionform.SxzbtypeActionForm"> </form-bean> <form-bean name="sxzbcontentForm" type="com.futuresoftware.ccmbam.actionform.SxzbcontentActionForm"> </form-bean> <!-- ********************************leadinfo begin***************************************** --> <form-bean name="hfcontentForm" type="com.futuresoftware.leadinfo.actionform.HfContentActionForm"> </form-bean> <form-bean name="zxmcontentForm" type="com.futuresoftware.leadinfo.actionform.ZxmContentActionForm" /> <form-bean name="contentForm" type="com.futuresoftware.leadinfo.actionform.ContentForm" /> <!-- ******************************** leadinfo end ***************************************** --> <!-- I18N --> <form-bean name="localeForm" type="org.apache.struts.action.DynaActionForm"> <form-property name="language" type="java.lang.String" /> <form-property name="country" type="java.lang.String" /> </form-bean> <!-- Search --> <form-bean name="SearchForm" type="org.apache.struts.action.DynaActionForm"> <form-property name="query" type="java.lang.String" /> </form-bean> <form-bean name="TelphoneForm" type="com.futuresoftware.ccmbam.actionform.TelphoneActionForm" /> </form-beans> <global-forwards> <forward name="index" path="/sxyhq.com/index.jsp" redirect="false"> </forward> </global-forwards> <!-- ========== Action Mapping Definitions Modify By lianglonglong begin 2006-3-13============================== --> <action-mappings> <action path="/upload" forward="/ccmbam/upload/upload.jsp" /> <!-- Upload Action --> <action path="/upload-submit" type="com.futuresoftware.ccmbam.webupload.UploadAction" name="uploadForm" scope="request" input="input"> <forward name="input" path="/ccmbam/upload/upload.jsp" /> <forward name="display" path="/ccmbam/upload/display.jsp" /> </action> <action path="/syncfileaction" type="com.futuresoftware.ccmbam.webupload.SyncFileUploadAction" name="uploadForm" scope="request" input="input"> <forward name="input" path="/ccmbam/syncfile/uploadsyncfile.jsp" /> </action> <action path="/upload" forward="/ccmbam/upload/columnpicupload.jsp" /> <!-- UploadFrontPic Action --> <action path="/uploadfrontpic" type="com.futuresoftware.ccmbam.webupload.UploadFrontPicAction" name="uploadForm" scope="request" input="input"> <forward name="input" path="/ccmbam/upload/uploadfrontpic.jsp" /> <forward name="displayfrontpic" path="/ccmbam/upload/displayfrontpic.jsp" /> </action> <!-- UploadBackPic Action --> <action path="/uploadbackpic" type="com.futuresoftware.ccmbam.webupload.UploadBackPicAction" name="uploadForm" scope="request" input="input"> <forward name="input" path="/ccmbam/upload/uploadbackpic.jsp" /> <forward name="displaybackpic" path="/ccmbam/upload/displaybackpic.jsp" /> </action> <!-- UploadAfterPic Action --> <action path="/uploadafterpic" type="com.futuresoftware.ccmbam.webupload.UploadAfterPicAction" name="uploadForm" scope="request" input="input"> <forward name="input" path="/ccmbam/upload/uploadafterpic.jsp" /> <forward name="displayafterpic" path="/ccmbam/upload/displayafterpic.jsp" /> </action> <action path="/PersonAction" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.PersonAction" validate="true" input="/error.jsp"> <forward name="getpersoninfo" path="/ccmbam/entrance/mainfrm.jsp" redirect="false" /> </action> <action path="/indexAction" name="AccountForm" parameter="dispatch" scope="session" type="com.futuresoftware.ccmbam.action.IndexAction" validate="true" input="/error.jsp"> <forward name="AccountLogin" path="/ccmbam/entrance/index.htm" redirect="false" /> </action> <!-- =======================SSO_Login============================ --> <!-- <action path="/ssologinAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.sso.login.LoginAction" validate="true" input="/error.jsp"> <forward name="loginTrue" path="/index.jsp" redirect="false" /> <forward name="loginFalse" path="/sso/login.jsp" redirect="false" /> </action> --> <action path="/ssologinAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.sso.login.LoginAction" validate="true" input="/error.jsp"> <forward name="loginTrue" path="/ssoIndexAction.do?dispatch=Index" redirect="true" /> <forward name="loginFalse" path="/sso/dl.jsp" redirect="false" /> </action> <action path="/ssoIndexAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.sso.login.IndexAction" validate="true" input="/error.jsp"> <forward name="loginTrue" path="/index.jsp" redirect="false" /> <forward name="loginFalse" path="/sso/dl.jsp" redirect="false" /> </action> <action path="/synAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.sso.syn.SynAction" validate="true"> </action> <action path="/uumMappAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.sso.login.UUMmappAction" validate="true"> </action> <action path="/contentAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.sso.login.ContentAction" validate="true" input="/error.jsp"> <!-- forward name="loginTrue" path="/sso/success.html" redirect="false" /--> <forward name="loginTrue" path="/sso/index.jsp" redirect="false" /> <forward name="loginFalse" path="/sso/login.jsp" redirect="false" /> </action> <action path="/WebSiteAction" name="WebsiteForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.WebsiteAction" validate="true" input="/error.jsp"> <forward name="addWebsitejump" path="/ccmbam/website/addWebsite.jsp" redirect="false" /> <forward name="addwebsite" path="/WebSiteAction.do?dispatch=listWebsite" redirect="yes" /> <forward name="getWebsiteDetail" path="/ccmbam/website/modifyWebsite.jsp" redirect="false" /> <forward name="getWebsiteInfo" path="/ccmbam/website/WebsiteInfo.jsp" redirect="false" /> <forward name="modifyWebsite" path="/WebSiteAction.do?dispatch=listWebsite" redirect="yes" /> <forward name="delWebsite" path="/WebSiteAction.do?dispatch=listWebsite" redirect="yes" /> <forward name="listWebsite" path="/ccmbam/website/listWebsite.jsp" redirect="false" /> <forward name="createWebsiteIndex" path="/WebSiteAction.do?dispatch=listWebsite" redirect="false" /> </action> <action path="/ColumninfoAction" name="ColumninfoForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.ColumninfoAction" validate="true" input="/error.jsp"> <forward name="addBatchTreeColumns" path="/ccmbam/column/addBatchColumns.jsp" redirect="false" /> <forward name="addchangeColumns" path="/ccmbam/column/addchangeColumn.jsp" redirect="false" /> <forward name="addColumninfojump" path="/ccmbam/column/addColumninfo.jsp" redirect="false" /> <forward name="addColumninfo" path="/ColumninfoAction.do?dispatch=ColumninfoListBySubid" redirect="false" /> <forward name="getColumninfoDetail" path="/ccmbam/column/modifyColumninfo.jsp" redirect="false" /> <forward name="getColumninfoInfo" path="/ccmbam/column/columnInfo.jsp" redirect="false" /> <forward name="modifyColumninfo" path="/ColumninfoAction.do?dispatch=ColumninfoListBySubid" redirect="false" /> <forward name="delColumninfo" path="/ColumninfoAction.do?dispatch=ColumninfoListBySubid" redirect="false" /> <forward name="listColumninfo" path="/ccmbam/column/listColumninfo.jsp" redirect="false" /> <forward name="columninfo" path="/ccmbam/column/column.jsp" redirect="false" /> <forward name="treeColumninfo" path="/ccmbam/column/treecolumn.jsp" redirect="false" /> <forward name="treeColumns" path="/ccmbam/column/addColumns.jsp" redirect="false" /> <forward name="treeCol" path="/ColumninfoAction.do?dispatch=treeColumninfo" redirect="false" /> <forward name="ColumninfoListBySubid" path="/ccmbam/column/columnList.jsp" redirect="false" /> <forward name="columninfoListAll" path="/ccmbam/column/columnList.jsp" redirect="false" /> <forward name="columninfoList" path="/ColumninfoAction.do?dispatch=ColumninfoListBySubid" redirect="false" /> <forward name="addchangeColumnsBs" path="/ccmbam/column/addchangeColumnBs.jsp" redirect="false" /> </action> <action path="/ContentAction" name="ContentForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.ContentAction" validate="true" input="/error.jsp"> <forward name="addContentjump" path="/ccmbam/content/addContent.jsp" redirect="false" /> <forward name="contentNewjump" path="/ccmbam/content/addContent_new.jsp" redirect="false" /> <forward name="addContent" path="/ContentAction.do?dispatch=ContentListBySubid" redirect="false" /> <forward name="getContentDetail" path="/ccmbam/content/modifyContent.jsp" redirect="false" /> <forward name="modifyContent" path="/ContentAction.do?dispatch=ContentListBySubid" redirect="false" /> <forward name="delContent" path="/ContentAction.do?dispatch=ContentListBySubid" redirect="false" /> <forward name="getContentInfo" path="/ccmbam/content/contentInfo.jsp" redirect="false" /> <forward name="content" path="/ccmbam/content/content.jsp" redirect="false" /> <forward name="treeContent" path="/ccmbam/content/treecontent.jsp" redirect="false" /> <forward name="treeCol" path="/ContentAction.do?dispatch=treeContent" redirect="false" /> <forward name="ContentListBySubid" path="/ccmbam/content/contentList.jsp" redirect="false" /> <forward name="ContentListByWebsite" path="/ccmbam/content/contentList.jsp" redirect="false" /> <forward name="contentListAll" path="/ccmbam/content/contentList.jsp" redirect="false" /> <forward name="contentList" path="/ContentAction.do?dispatch=ContentListBySubid" redirect="false" /> <forward name="setTopContent" path="/ContentAction.do?dispatch=ContentListBySubid" redirect="false" /> <forward name="ensureSequence" path="/ContentAction.do?dispatch=ContentListBySubid" redirect="false" /> <forward name="isDelContentList" path="/ccmbam/recovery/recoverdelcontent.jsp" redirect="false" /> <forward name="recoverDelContent" path="/ContentAction.do?dispatch=isDelContentList" redirect="false" /> <forward name="delOrOvertimeContentList" path="/ccmbam/recovery/physicsdelcontent.jsp" redirect="false" /> <forward name="physicsDelContent" path="/ContentAction.do?dispatch=delOrOvertimeContentList" redirect="false" /> <forward name="previewContent" path="/ccmbam/content/preview.jsp" redirect="false" /> <forward name="websiteOpenContent" path="/ccmbam/content/listwebsiterootcol.jsp" redirect="false" /> <!-- forward name="plancontentListByColum" path="/plancontent.do?dispatch=listPlanContent" redirect="false" /> --> <!-- wubo modify --> <forward name="accessNumStatistics" path="/ccmbam/content/accessNumStatistics.jsp" redirect="false" /> <forward name="contentList" path="/ContentAction.do?dispatch=BSContentListBySubid" redirect="false" /> <forward name="BSContentListBySubid" path="/ccmbam/content/bscontentList.jsp" redirect="false" /> <forward name="bscontentNewjump" path="/ccmbam/content/addBSContent_new.jsp" redirect="false" /> <forward name="getBSContentDetail" path="/ccmbam/content/modifyBSContent.jsp" redirect="false" /> </action> <action path="/ContenttypeAction" name="ContentTypeForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.ContenttypeAction" validate="true" input="/error.jsp"> <forward name="addContenttypejump" path="/ccmbam/contenttype/addContenttype.jsp" redirect="false" /> <forward name="addContenttype" path="/ContenttypeAction.do?dispatch=listContenttype" redirect="yes" /> <forward name="getContenttypeDetail" path="/ccmbam/contenttype/modifyContenttype.jsp" redirect="false" /> <forward name="modifyContenttype" path="/ContenttypeAction.do?dispatch=listContenttype" redirect="yes" /> <forward name="delContenttype" path="/ContenttypeAction.do?dispatch=listContenttype" redirect="yes" /> <forward name="listContenttype" path="/ccmbam/contenttype/listContenttype.jsp" redirect="false" /> <forward name="getContenttypeInfo" path="/ccmbam/contenttype/ContenttypeInfo.jsp" redirect="false" /> </action> <action path="/TemplateAction" name="TemplateForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.TemplateAction" validate="true" input="/error.jsp"> <forward name="addTemplatejump" path="/ccmbam/template/addTemplate.jsp" redirect="false" /> <forward name="addTemplate" path="/TemplateAction.do?dispatch=listTemplate" redirect="yes" /> <forward name="getTemplateDetail" path="/ccmbam/template/modifyTemplate.jsp" redirect="false" /> <forward name="modifyTemplate" path="/TemplateAction.do?dispatch=listTemplate" redirect="yes" /> <forward name="delTemplate" path="/TemplateAction.do?dispatch=listTemplate" redirect="yes" /> <forward name="listTemplate" path="/ccmbam/template/listTemplate.jsp" redirect="false" /> <forward name="getTemplateInfo" path="/ccmbam/template/TemplateInfo.jsp" redirect="false" /> </action> <action path="/FucdefineAction" name="FucdefineForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.FucdefineAction" validate="true" input="/error.jsp"> <forward name="addFucdefinejump" path="/ccmbam/fucdefine/addFucdefine.jsp" redirect="false" /> <forward name="addFucdefine" path="/FucdefineAction.do?dispatch=listFucdefine" redirect="yes" /> <forward name="getFucdefineDetail" path="/ccmbam/fucdefine/modifyFucdefine.jsp" redirect="false" /> <forward name="modifyFucdefine" path="/FucdefineAction.do?dispatch=listFucdefine" redirect="yes" /> <forward name="delFucdefine" path="/FucdefineAction.do?dispatch=listFucdefine" redirect="yes" /> <forward name="listFucdefine" path="/ccmbam/fucdefine/listFucdefine.jsp" redirect="false" /> <forward name="getFucdefineInfo" path="/ccmbam/fucdefine/FucdefineInfo.jsp" redirect="false" /> </action> <action path="/DepartmentAction" name="DepartmentForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.DepartmentAction" validate="true" input="/error.jsp"> <forward name="addDepartmentjump" path="/ccmbam/department/addDepartment.jsp" redirect="false" /> <forward name="addDepartment" path="/DepartmentAction.do?dispatch=listDepartment" redirect="yes" /> <forward name="getDepartmentDetail" path="/ccmbam/department/modifyDepartment.jsp" redirect="false" /> <forward name="modifyDepartment" path="/DepartmentAction.do?dispatch=listDepartment" redirect="yes" /> <forward name="delDepartment" path="/DepartmentAction.do?dispatch=listDepartment" redirect="yes" /> <forward name="listDepartment" path="/ccmbam/department/listDepartment.jsp" redirect="false" /> <forward name="getDepartmentInfo" path="/ccmbam/department/DepartmentInfo.jsp" redirect="false" /> </action> <action path="/RoleAction" name="RoleForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.RoleAction" validate="true" input="/error.jsp"> <forward name="addRolejump" path="/ccmbam/role/addRole.jsp" redirect="false" /> <forward name="addRole" path="/RoleAction.do?dispatch=listRole" redirect="yes" /> <forward name="getRoleDetail" path="/ccmbam/role/modifyRole.jsp" redirect="false" /> <forward name="modifyRole" path="/RoleAction.do?dispatch=listRole" redirect="yes" /> <forward name="delRole" path="/RoleAction.do?dispatch=listRole" redirect="yes" /> <forward name="listRole" path="/ccmbam/role/listRole.jsp" redirect="false" /> <forward name="getRoleInfo" path="/ccmbam/role/RoleInfo.jsp" redirect="false" /> </action> <action path="/AccountAction" name="AccountForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.AccountAction" validate="true" input="/error.jsp"> <forward name="addAccountjump" path="/ccmbam/account/addAccount.jsp" redirect="false" /> <forward name="addAccount" path="/AccountAction.do?dispatch=listAccount" redirect="yes" /> <forward name="getAccountDetail" path="/ccmbam/account/modifyAccount.jsp" redirect="false" /> <forward name="getAccountInfo" path="/ccmbam/account/AccountInfo.jsp" redirect="false" /> <forward name="modifyAccount" path="/AccountAction.do?dispatch=listAccount" redirect="yes" /> <forward name="delAccount" path="/AccountAction.do?dispatch=listAccount" redirect="yes" /> <forward name="listAccount" path="/ccmbam/account/listAccount.jsp" redirect="false" /> <forward name="checkAccount" path="/ccmbam/account/checkAccount.jsp" redirect="false" /> </action> <action path="/CmsuserAction" name="CmsuserForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.CmsuserAction" validate="true" input="/error.jsp"> <forward name="addCmsuserjump" path="/ccmbam/cmsuser/addCmsuser.jsp" redirect="false" /> <forward name="addCmsuser" path="/CmsuserAction.do?dispatch=listCmsuser" redirect="yes" /> <forward name="getCmsuserDetail" path="/ccmbam/cmsuser/modifyCmsuser.jsp" redirect="false" /> <forward name="getCmsuserInfo" path="/ccmbam/cmsuser/CmsuserInfo.jsp" redirect="false" /> <forward name="modifyCmsuser" path="/CmsuserAction.do?dispatch=listCmsuser" redirect="yes" /> <forward name="delCmsuser" path="/CmsuserAction.do?dispatch=listCmsuser" redirect="yes" /> <forward name="listCmsuser" path="/ccmbam/cmsuser/listCmsuser.jsp" redirect="false" /> </action> <action path="/FlowdefineAction" name="FlowdefineForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.FlowdefineAction" validate="true" input="/error.jsp"> <forward name="addFlowdefinejump" path="/ccmbam/flowdefine/addFlowdefine.jsp" redirect="false" /> <forward name="addFlowdefine" path="/FlowdefineAction.do?dispatch=listFlowdefine" redirect="yes" /> <forward name="getFlowdefineDetail" path="/ccmbam/flowdefine/modifyFlowdefine.jsp" redirect="false" /> <forward name="getFlowdefineInfo" path="/ccmbam/flowdefine/FlowdefineInfo.jsp" redirect="false" /> <forward name="modifyFlowdefine" path="/FlowdefineAction.do?dispatch=listFlowdefine" redirect="yes" /> <forward name="delFlowdefine" path="/FlowdefineAction.do?dispatch=listFlowdefine" redirect="yes" /> <forward name="listFlowdefine" path="/ccmbam/flowdefine/listFlowdefine.jsp" redirect="false" /> </action> <action path="/FlowtaskAction" name="FlowtaskForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.FlowtaskAction" validate="true" input="/error.jsp"> <forward name="addFlowtaskjump" path="/ccmbam/flowtask/addFlowtask.jsp" redirect="false" /> <forward name="addFlowtask" path="/FlowtaskAction.do?dispatch=listFlowtask" redirect="yes" /> <forward name="getFlowtaskDetail" path="/ccmbam/flowtask/modifyFlowtask.jsp" redirect="false" /> <forward name="getFlowtaskInfo" path="/ccmbam/flowtask/FlowtaskInfo.jsp" redirect="false" /> <forward name="modifyFlowtask" path="/FlowtaskAction.do?dispatch=listFlowtask" redirect="yes" /> <forward name="delFlowtask" path="/FlowtaskAction.do?dispatch=listFlowtask" redirect="yes" /> <forward name="listFlowtask" path="/ccmbam/flowtask/listFlowtask.jsp" redirect="false" /> <forward name="flowtaskFrame" path="/ccmbam/flowtask/FlowtaskFrame.jsp" redirect="false" /> <forward name="flowtaskList" path="/ccmbam/flowtask/FlowtaskList.jsp" redirect="false" /> </action> <action path="/RolefucpermsAction" name="RolefucpermForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.RolefucpermsAction" validate="true" input="/error.jsp"> <forward name="rolefucperms" path="/ccmbam/rolefucperms/rolefucperms.jsp" redirect="false" /> <forward name="rolelist" path="/ccmbam/rolefucperms/rolelist.jsp" redirect="false" /> <forward name="fucdefinelist" path="/ccmbam/rolefucperms/fucdefinelist.jsp" redirect="false" /> <forward name="modifyrolefucperms" path="/RolefucpermsAction.do?dispatch=rolefucperms" redirect="yes" /> </action> <action path="/PublishAction" name="ContentForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.PublishAction" validate="true" input="/error.jsp"> <forward name="nopublish" path="/ccmbam/publish/nopublish.jsp" redirect="false" /> <forward name="alreadypub" path="/ccmbam/publish/alreadypub.jsp" redirect="false" /> <forward name="infoverify" path="/ccmbam/publish/infoverify.jsp" redirect="false" /> <forward name="issue" path="/ccmbam/publish/issue.jsp" redirect="false" /> <forward name="doissue" path="/PublishAction.do?dispatch=infoverify" redirect="yes" /> <forward name="success" path="/success.jsp"></forward> </action> <action path="/PublishBatAction" name="ContentForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.PublishBatAction" validate="true" input="/error.jsp"> <forward name="bySite" path="/ccmbam/website/listWebsite.jsp" redirect="false" /> <forward name="dobySite" path="/WebSiteAction.do?dispatch=listWebsite" redirect="false" /> <forward name="batchinfoverify" path="/ccmbam/publishbat/batchinfoverify.jsp" redirect="false" /> <forward name="getContIdjump" path="/ccmbam/publishbat/batchissue.jsp" redirect="false" /> <forward name="doByConts" path="/PublishBatAction.do?dispatch=batchinfoverify" redirect="yes" /> </action> <action path="/StatistAction" name="StatistForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.StatistAction" validate="true" input="/error.jsp"> <forward name="statistjump" path="/ccmbam/statist/statistIndex.jsp" redirect="false" /> <forward name="statistMenuList" path="/ccmbam/statist/statisttop.jsp" redirect="false" /> <forward name="statistList" path="/ccmbam/statist/statistmain.jsp" redirect="false" /> <!-- forward name="statistDetailjump" path="/ccmbam/statist/statistContent.jsp" redirect="false" /--> <forward name="statistDetailjump" path="/ccmbam/statist/statistUser.jsp" redirect="false" /> <forward name="statistCommon" path="/ccmbam/statist/statistCommon.jsp" redirect="false" /> <forward name="statistCommonMenuList" path="/ccmbam/statist/statistCommontop.jsp" redirect="false" /> <forward name="statistCommonjump" path="/ccmbam/statist/statistCommonIndex.jsp" redirect="false" /> <forward name="listWebsiteAccessSum" path="/ccmbam/statist/listwebsiteaccesssum.jsp" redirect="false"> </forward> <forward name="listWebsiteAccessDetail" path="/ccmbam/statist/listwebsiteaccessdetail.jsp" redirect="false"> </forward> </action> <action path="/DBAction" name="ContentForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.DBAction" validate="true" input="/error.jsp"> <forward name="exportDB" path="/ccmbam/export/exportDB.jsp" redirect="false" /> <forward name="exportTable" path="/ccmbam/export/exportTable.jsp" redirect="false" /> </action> <action path="/RomoteHtmlFileAction" name="RomoteForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.RomoteHtmlFileAction" validate="true" input="/error.jsp"> <forward name="romotefile" path="/ccmbam/romotefile/romotefile.jsp" redirect="false" /> <forward name="romotefile2" path="/ccmbam/romotefile/romotefile2.jsp" redirect="false" /> <forward name="setRomoteHtml" path="/ccmbam/romotefile/addRomote.jsp" redirect="false" /> <forward name="getRomoteDetail" path="/ccmbam/romotefile/modifyRomote.jsp" redirect="false" /> <forward name="listRomote" path="/ccmbam/romotefile/listRomote.jsp" redirect="false" /> <forward name="delRomote" path="/RomoteHtmlFileAction.do?dispatch=listRomote" redirect="yes" /> <forward name="getRomoteInfo" path="/ccmbam/romotefile/romoteInfo.jsp" redirect="false" /> <forward name="doRomoteHtml" path="/ccmbam/romotefile/doRomote.jsp" redirect="false" /> <forward name="doDBRomoteHtml" path="/ccmbam/romotefile/doRomote.jsp" redirect="false" /> <forward name="doDBCRomoteHtml" path="/ccmbam/romotefile/doRomote.jsp" redirect="false" /> </action> <action path="/VoteAction" name="VoteForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.VoteAction" validate="true" input="/error.jsp"> <forward name="addVotejump" path="/ccmbam/vote/addVote.jsp" redirect="false" /> <forward name="addVote" path="/VoteAction.do?dispatch=listVote" redirect="yes" /> <forward name="getVoteDetail" path="/ccmbam/vote/modifyVote.jsp" redirect="false" /> <forward name="getVoteInfo" path="/ccmbam/vote/VoteInfo.jsp" redirect="false" /> <forward name="modifyVote" path="/VoteAction.do?dispatch=listVote" redirect="yes" /> <forward name="delVote" path="/VoteAction.do?dispatch=listVote" redirect="yes" /> <forward name="listVote" path="/ccmbam/vote/listVote.jsp" redirect="false" /> </action> <action path="/LetterAction" name="LetterForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.LetterAction" validate="true" input="/error.jsp"> <forward name="addLetterjump" path="/letter.jsp" redirect="false" /> <forward name="addLetter" path="/letterend.jsp" redirect="yes" /> <forward name="getLetterDetail" path="/ccmbam/letter/modifyLetter.jsp" redirect="false" /> <forward name="modifyLetter" path="/LetterAction.do?dispatch=listLetter" redirect="yes" /> <forward name="delLetter" path="/LetterAction.do?dispatch=listLetter" redirect="yes" /> <forward name="listLetter" path="/ccmbam/letter/listLetter.jsp" redirect="false" /> <forward name="getLetterInfo" path="/ccmbam/letter/LetterInfo.jsp" redirect="false" /> <forward name="sendMail" path="/ccmbam/letter/letter.jsp" redirect="false" /> <forward name="success" path="/success.jsp"></forward> </action> <!--I18N--> <action path="/locale" scope="request" type="com.futuresoftware.ccmbam.action.LocaleAction" name="localeForm" input="/error.jsp"> </action> <!-- search --> <action path="/SearchAction" name="SearchForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.SearchAction" validate="true" input="/error.jsp"> <forward name="ldSearchQuery" path="/lyweb/searcher.jsp" redirect="false" /> </action> <action path="/DbSearchAction" name="SearchForm" parameter="dispatch" scope="request" type="com.futuresoftware.leadinfo.action.SearchAction" validate="true" input="/error.jsp"> <forward name="SearchQuery" path="/lyweb/searcher.jsp" redirect="false" /> </action> <!-- Portal Action --> <action path="/IndexPortalAction" scope="request" type="com.futuresoftware.portal.action.IndexPortalAction" validate="true" input="/error.jsp"> </action> <action path="/ContentAccessAction" scope="request" type="com.futuresoftware.portal.action.ContentAccessAction" validate="true" input="/error.jsp"> </action> <action path="/IssuedContentAction" parameter="dispatch" scope="request" type="com.futuresoftware.portal.action.IssuedContentAction" validate="true"> <forward name="error" path="/error.jsp" redirect="false" /> <forward name="bmfw" path="/portal/vm/bmfw/VMForBmfwList.vm" redirect="false" /> <forward name="zwyw" path="/portal/vm/zwyw/VMForZwywList.vm" redirect="false" /> <forward name="yjgl" path="/portal/vm/yjgl/VMForYjglList.vm" redirect="false" /> <forward name="list" path="/portal/vm/list/VMForCommonList.vm" redirect="false" /> <forward name="more" path="/portal/vm/more/VMForCommonMore.vm" redirect="false" /> <forward name="contentbody" path="/portal/vm/content/VMForContent.vm" redirect="false" /> <forward name="zfxwfb" path="/portal/vm/xwfb/VMForXwfbMore.vm" redirect="false" /> <forward name="zjxx" path="/portal/vm/zjxx/VMForZjxxMore.vm" redirect="false" /> <forward name="wzjs" path="/portal/vm/wzjs/VMForWzjs.vm" redirect="false" /> <forward name="yfxz" path="/portal/vm/yfxz/VMForYfxzList.vm" redirect="false" /> <forward name="contentlist" path="/portal/vm/tsjb/VMForTsjbContent.vm" redirect="false" /> <forward name="tsjb" path="/portal/vm/tsjb/VMForTsjb.vm" redirect="false" /> <forward name="jgsz" path="/portal/vm/yjgl/VMForYjglJgsz.vm" redirect="false" /> <forward name="yjya" path="/portal/vm/yjgl/VMForYjglYjya.vm" redirect="false" /> </action> <!-- Gov File System --> <action path="/GovfileContentAction" parameter="dispatch" scope="request" type="com.futuresoftware.portal.action.GovfileContentAction" validate="true"> <forward name="govmore" path="/portal/vm/govfile/VMForGovfileMore.vm" redirect="false" /> <forward name="contentlist" path="/portal/vm/govfile/VMForGovFileList.vm" redirect="false" /> <forward name="lhfw" path="/portal/vm/govfile/VMForLhfwMore.vm" redirect="false" /> <forward name="zfgzbg" path="/portal/vm/govfile/VMForGovZfgzbg.vm" redirect="false" /> <forward name="zwgg" path="/portal/vm/govfile/VMForGovZwgg.vm" redirect="false" /> <forward name="rsxx" path="/portal/vm/govfile/VMForRsxxMore.vm" redirect="false" /> <forward name="ysxt" path="/portal/vm/govfile/VMForYsxtMore.vm" redirect="false" /> <forward name="rslb" path="/portal/vm/govfile/VMForRsxxList.vm" redirect="false" /> </action> <action path="/FiletypeAction" name="FiletypeForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.GovfiletypeAction" validate="true" input="/error.jsp"> <forward name="addFiletypejump" path="/ccmbam/govfile/filetype/addFiletype.jsp" redirect="false" /> <forward name="addFiletype" path="/FiletypeAction.do?dispatch=listFiletype" redirect="yes" /> <forward name="getFiletypeDetail" path="/ccmbam/govfile/filetype/modifyFiletype.jsp" redirect="false" /> <forward name="modifyFiletype" path="/FiletypeAction.do?dispatch=listFiletype" redirect="yes" /> <forward name="delFiletype" path="/FiletypeAction.do?dispatch=listFiletype" redirect="yes" /> <forward name="listfiletype" path="/ccmbam/govfile/filetype/listFiletype.jsp" redirect="false" /> <forward name="getFiletypeInfo" path="/ccmbam/govfile/filetype/filetypeInfo.jsp" redirect="false" /> </action> <action path="/CallingAction" name="CallingForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.GovfileunitcallingAction" validate="true" input="/error.jsp"> <forward name="addCallingjump" path="/ccmbam/govfile/calling/addColumninfo.jsp" redirect="false" /> <forward name="getCallingInfo" path="/CallingAction.do?dispatch=callingList" redirect="false" /> <forward name="getDatCalling" path="/ccmbam/govfile/calling/modifycalling.jsp" redirect="false" /> <forward name="delColumninfo" path="/CallingAction.do?dispatch=callingList" redirect="false" /> <forward name="callinginfo" path="/ccmbam/govfile/calling/calling.jsp" redirect="false" /> <forward name="treeColumninfo" path="/ccmbam/govfile/calling/treecolumn.jsp" redirect="false" /> <forward name="treeCol" path="/CallingAction.do?dispatch=treeColumninfo" redirect="false" /> <forward name="callingList" path="/ccmbam/govfile/calling/callingList.jsp" redirect="false" /> </action> <action path="/WenzhongAction" name="wenzhongForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.GovfilewenzhongAction" validate="true" input="/error.jsp"> <forward name="govFileinfo" path="/ccmbam/govfile/file/file.jsp" redirect="false" /> <forward name="addWenzongjump" path="/ccmbam/govfile/wenzong/addwenzong.jsp" redirect="false" /> <forward name="addwenzong" path="/WenzhongAction.do?dispatch=listWenzong" redirect="yes" /> <forward name="getWenzongDetail" path="/ccmbam/govfile/wenzong/modifywenzong.jsp" redirect="false" /> <forward name="modifyWenzong" path="/WenzhongAction.do?dispatch=listWenzong" redirect="yes" /> <forward name="delWenzong" path="/WenzhongAction.do?dispatch=listWenzong" redirect="yes" /> <forward name="listWenzong" path="/ccmbam/govfile/wenzong/listwenzong.jsp" redirect="false" /> <forward name="getWenzongInfo" path="/ccmbam/govfile/wenzong/wenzong.jsp" redirect="false" /> </action> <action path="/FilecontentAction" name="filecontentForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.GovfilecontentAction" validate="true" input="/error.jsp"> <forward name="govFileinfo" path="/ccmbam/govfile/file/file.jsp" redirect="false" /> <forward name="fileList" path="/ccmbam/govfile/file/listfile.jsp" redirect="false" /> <forward name="addFilejump" path="/ccmbam/govfile/file/addfile.jsp" redirect="false" /> <forward name="addFile" path="/FilecontentAction.do?dispatch=fileList" redirect="yes" /> <forward name="getFileDetail" path="/ccmbam/govfile/file/fileInfo.jsp" redirect="false" /> <forward name="previewContent" path="/ccmbam/govfile/file/preview.jsp" redirect="false" /> </action> <!-- fzgh --> <!-- action path="/plancontent" name="plancontentForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.PlancontentAction" validate="true" input="/error.jsp"> <forward name="listPlanContent" path="/ccmbam/planfile/listplancontent.jsp"></forward> <forward name="addContentjump" path="/ccmbam/planfile/addplancontent.jsp"></forward> <forward name="addContent" path="/plancontent.do?dispatch=listPlanContent" redirect="false"></forward> <forward name="delContent" path="/plancontent.do?dispatch=listPlanContent" redirect="false"></forward> <forward name="getContentInfo" path="/ccmbam/planfile/plancontentinfo.jsp" redirect="false"></forward> <forward name="getContentDetail" path="/ccmbam/planfile/modifplancontent.jsp" redirect="false"></forward> <forward name="modifyContent" path="/plancontent.do?dispatch=listPlanContent" redirect="false" ></forward> </action> --> <!-- Plan Content --> <!-- action path="/PlancontentAction" parameter="dispatch" scope="request" type="com.futuresoftware.portal.action.PlancontentAction" validate="true"> <forward name="planmore" path="/portal/vm/plancont/VMForPlancontent.vm" redirect="false"/> <forward name="planContentbody" path="/portal/vm/plancont/VMForPlancontentNeirong.vm" redirect="false"/> <forward name="gzzd" path="/portal/vm/plancont/VMForPlanList.vm" redirect="false"/> <forward name="ghtjgb" path="/portal/vm/plancont/VMForPlanListByZiId.vm" redirect="false"/> <forward name="vfpma" path="/portal/vm/plancont/VMForPlanMoreAll.vm" redirect="false"/> <forward name="vfpm" path="/portal/vm/plancont/VMForPlanMore.vm" redirect="false"/> </action> --> <action path="/SxzbtypeAction" name="sxzbtypeForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.SxzbtypeAction" validate="true" input="/error.jsp"> <forward name="addSxzbtypejump" path="/ccmbam/sxzbtype/addSxzbtype.jsp" redirect="false" /> <forward name="addSxzbtype" path="/SxzbtypeAction.do?dispatch=listSxzbtype" redirect="yes" /> <forward name="getSxzbtypeDetail" path="/ccmbam/sxzbtype/modifySxzbtype.jsp" redirect="false" /> <forward name="getSxzbtypeInfo" path="/ccmbam/sxzbtype/SxzbtypeInfo.jsp" redirect="false" /> <forward name="modifySxzbtype" path="/SxzbtypeAction.do?dispatch=listSxzbtype" redirect="yes" /> <forward name="delSxzbtype" path="/SxzbtypeAction.do?dispatch=listSxzbtype" redirect="yes" /> <forward name="listSxzbtype" path="/ccmbam/sxzbtype/listSxzbtype.jsp" redirect="false" /> </action> <action path="/SxzbcontentAction" name="sxzbcontentForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.SxzbcontentAction" validate="true" input="/error.jsp"> <forward name="addSxzbcontentjump" path="/ccmbam/sxzbcontent/addSxzbcontent.jsp" redirect="false" /> <forward name="addSxzbcontent" path="/SxzbcontentAction.do?dispatch=listSxzbcontent" redirect="yes" /> <forward name="getSxzbcontentDetail" path="/ccmbam/sxzbcontent/modifySxzbcontent.jsp" redirect="false" /> <forward name="getSxzbcontentInfo" path="/ccmbam/sxzbcontent/SxzbcontentInfo.jsp" redirect="false" /> <forward name="modifySxzbcontent" path="/SxzbcontentAction.do?dispatch=listSxzbcontent" redirect="yes" /> <forward name="delSxzbcontent" path="/SxzbcontentAction.do?dispatch=listSxzbcontent" redirect="yes" /> <forward name="listSxzbcontent" path="/ccmbam/sxzbcontent/listSxzbcontent.jsp" redirect="false" /> <forward name="sxzbpreviewContent" path="/ccmbam/sxzbcontent/preview.jsp" redirect="false" /> </action> <action path="/SxzbcontentVMAction" parameter="dispatch" scope="request" type="com.futuresoftware.portal.action.SxzbcontentVMAction" validate="true"> <forward name="zfgbmore" path="/portal/vm/zfgb/VMForZfgbmore.vm" redirect="false" /> <forward name="zfgbsearch" path="/portal/vm/zfgb/VMForZfgbsearch.vm" redirect="false" /> </action> <action path="/GwyAction" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.GwyAction" validate="true"> </action> <!-- ***************************************xinhuaBegin******************************************* --> <action path="/xinhuaAction" parameter="dispatch" scope="request" type="com.futuresoftware.leadinfo.action.XinhuaAction" validate="true"> <forward name="xinhuainfo" path="/new/index.jsp" redirect="false" /> <forward name="xinhua" path="/new/test.jsp" redirect="false" /> </action> <action path="/hfcontentAction" parameter="dispatch" scope="request" name="hfcontentForm" type="com.futuresoftware.leadinfo.action.HfContInfoAction" validate="true"> <forward name="hfcontinfo" path="/new/leaders/hfleader.jsp" redirect="false" /> <forward name="error" path="/new/test.jsp" redirect="false" /> <forward name="listContent" path="/new/leaders/list.jsp" redirect="false" /> </action> <action path="/zxmcontentAction" parameter="dispatch" scope="request" name="zxmcontentForm" type="com.futuresoftware.leadinfo.action.ZxmContInfoAction" validate="true"> <forward name="zxmcontinfo" path="/new/leaders/zxmleader.jsp" redirect="false" /> <forward name="listContent" path="/new/leaders/list.jsp" redirect="false" /> <forward name="contentbody" path="/new/leaders/content.jsp"> </forward> </action> <!-- <action path="/loginleaderAction" parameter="dispatch" scope="request" type="com.futuresoftware.leadinfo.action.LoginAction" validate="true"> <forward name="loginok" path="/xinhuaAction.do?dispatch=SelXinhuaInfo" redirect="false" /> <forward name="loginerror" path="/error.jsp" redirect="false" /> </action> --> <action path="/loginleaderAction" parameter="dispatch" scope="request" type="com.futuresoftware.leadinfo.action.LoginAction" validate="true"> <forward name="loginok" path="/xinhuaAction.do?dispatch=SelXinhuaInfo" redirect="false" /> <forward name="loginerror" path="/error.jsp" redirect="false" /> </action> <!-- =======================linye web litao ============================ --> <action path="/ldSsologinAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.LdLoginAction" validate="true" input="/error.jsp"> <forward name="loginTrue" path="/leadIndexAction.do?dispatch=Login" redirect="true" /> <forward name="loginFalse" path="/lyldweb/login.jsp" redirect="false" /> </action> <action path="/ptInfoAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.sso.pt.PtContentAction" validate="true" input="/error.jsp"> <forward name="platOdd" path="/lyweb/platOdd.jsp" redirect="false" /> <forward name="platEven" path="/lyweb/platEven.jsp" redirect="false" /> <forward name="platContent" path="/lyweb/platContent.jsp" redirect="false" /> <forward name="platLead" path="/lyweb/platLead.jsp" redirect="false" /> <forward name="platError" path="/error.jsp" redirect="false" /> </action> <action path="/xinxiInfoAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.XxContInfoAction" validate="true" input="/error.jsp"> <forward name="XinXiInfo" path="/lyweb/xxpt.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/shenghuoInfoAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.ShContInfoAction" validate="true" input="/error.jsp"> <forward name="ShengHuoInfo" path="/lyweb/shpt.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/sjzqInfoAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.SjzqContInfoAction" validate="true" input="/error.jsp"> <forward name="SjzqInfo" path="/lyweb/sjzq.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/xzzqInfoAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.XzzqContInfoAction" validate="true" input="/error.jsp"> <forward name="XzzqInfo" path="/lyweb/xzzq.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/gxfwInfoAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.GxfwContInfoAction" validate="true" input="/error.jsp"> <forward name="GxfwInfo" path="/lyweb/gxfw.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/lssyInfoAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.LssyAction" validate="true" input="/error.jsp"> <forward name="lssyInfo" path="/lyweb/lssy.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/xuexiAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.XuexiInfoAction" validate="true" input="/error.jsp"> <forward name="Xuexi" path="/lyweb/xuexipt.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/xxptAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.XxptInfoAction" validate="true" input="/error.jsp"> <forward name="XinXi" path="/lyweb/xinxipt.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/shptAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.ShInfoAction" validate="true" input="/error.jsp"> <forward name="ShengHuo" path="/lyweb/shenghuopt.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/bgptAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.BgInfoAction" validate="true" input="/error.jsp"> <forward name="BanGong" path="/lyweb/bangongpt.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/jlptAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.JlInfoAction" validate="true" input="/error.jsp"> <forward name="JiaoLiu" path="/lyweb/jiaoliupt.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <action path="/leadIndexAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.action.LdIndexAction" validate="true" input="/error.jsp"> <forward name="Success" path="/lyldweb/index.jsp" redirect="false" /> <forward name="Success1" path="/lyldweb/index1.jsp" redirect="false" /> <forward name="MoreSuccess" path="/lyldweb/more.jsp" redirect="false" /> <forward name="More1Success" path="/lyldweb/more1.jsp" redirect="false" /> <forward name="False" path="/error.jsp" redirect="false" /> </action> <!-- wubo --> <action path="/XTreeLoadAction" parameter="dispatch" scope="session" type="com.futuresoftware.leadinfo.util.XTreeLoadAction" validate="true" input="/error.jsp"> <forward name="treeDepts" path="/lyweb/xtreeDept.jsp" redirect="false" /> <forward name="searchName" path="/lyweb/searchName.jsp" redirect="false" /> </action> <action path="/TelphoneAction" name="TelphoneForm" parameter="dispatch" scope="request" type="com.futuresoftware.ccmbam.action.TelphoneAction" validate="true" input="/error.jsp"> <forward name="ListDept" path="/TelphoneAction.do?dispatch=listDept" redirect="false" /> <forward name="ListChushi" path="/TelphoneAction.do?dispatch=listChushi" redirect="false" /> <forward name="ListUser" path="/TelphoneAction.do?dispatch=listUser" redirect="false" /> <forward name="ListTelphone" path="/TelphoneAction.do?dispatch=listTelphone" redirect="yes" /> <forward name="addTelphonejump" path="/ccmbam/telphone/addTelphone.jsp" redirect="yes" /> <forward name="addTelphone" path="/TelphoneAction.do?dispatch=listTelphone" redirect="yes" /> <forward name="getTelphoneInfo" path="/ccmbam/telphone/telphoneInfo.jsp" redirect="false" /> <forward name="getTelphoneDetail" path="/ccmbam/telphone/modifyTelphone.jsp" redirect="false" /> <forward name="modifyTelphone" path="/TelphoneAction.do?dispatch=listTelphone" redirect="yes" /> <forward name="delTelphone" path="/TelphoneAction.do?dispatch=listTelphone" redirect="yes" /> <forward name="showdept" path="/lyweb/teldept.jsp" redirect="false" /> <forward name="showchushi" path="/lyweb/telchushi.jsp" redirect="false" /> <forward name="showuser" path="/lyweb/teluser.jsp" redirect="false" /> <forward name="searchuser" path="/lyweb/searchuser.jsp" redirect="false" /> <forward name="listallTelphone" path="/ccmbam/telphone/listTelphone.jsp" redirect="false" /> <forward name="ouchushinicheng" path="/lyweb/telxu.jsp"></forward> <forward name="listuserxu" path="/lyweb/listuserxu.jsp"></forward> <forward name="selectUserBydeptnameChushi" path="/lyweb/teluserxu.jsp"> </forward> <forward name="selectUserBysonou" path="/lyweb/teluserxu.jsp"> </forward> <!-- 2010-9-19 update--> <forward name="selectTelphoneAll" path="/lyweb/telxu.jsp"> </forward> <!-- 2010-9-20 --> <forward name="userlist" path="/lyweb/teluserxu.jsp"></forward> </action> </action-mappings> <!-- ========== Action Mapping Definitions Modify By lianglonglong end 2006-3-13============================== --> <!-- ========== Controller Configuration ================================ --> <controller maxFileSize="1M" inputForward="true" /> <!-- ========== Message Resources Definitions =========================== --> <message-resources parameter="com.futuresoftware.resources.ApplicationResources" /> <!-- ========== Plug Ins Configuration ================================== --> <!-- plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/> </plug-in--> <plug-in className="com.futuresoftware.ccmbam.util.InitializeData" /> </struts-config> |
|||
web.xml | xmlapi | ||
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>ROOT</display-name> <context-param> <!--application范围内的参数,存放在servletcontext中 --> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/applicationContext.xml,classpath:applicationContext-*.xml </param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/hibernate-context.xml</param-value> </context-param> <context-param> <param-name>directoryListing</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.properties</param-value> </context-param> <!-- 过滤器,为了过滤字符编码--> <filter> <filter-name>EncodingFilter</filter-name> <filter-class> com.futuresoftware.ccmbam.util.EncodingFilter </filter-class> <!--传入指定的参数,init-param指的是初始化参数,在类中可以调用 --> <!--public class EncodingFilter implements Filter { private static String encoding="UTF-8"; public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { request.setCharacterEncoding(EncodingFilter.encoding); response.setCharacterEncoding(EncodingFilter.encoding); chain.doFilter(request,response); } public void init(FilterConfig config) throws ServletException { String charset=config.getInitParameter("encoding"); if(null!=charset && !"".equals(charset.trim())){ EncodingFilter.encoding=charset; } } --> <init-param> <param-name>encoding</param-name> <param-value>GBK</param-value> </init-param> </filter> <filter> <!-- 关于OpenSessionInViewFilter 的介绍在 http://woshixushigang.iteye.com/blog/1144585 中有介绍--> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter </filter-class> </filter> <filter> <filter-name>LoginFilter</filter-name> <filter-class> com.futuresoftware.leadinfo.sso.filter.LoginFilter </filter-class> </filter> <filter-mapping> <!--访问项目的各个网页都会走过滤字节的类 --> <filter-name>EncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <!--对地址为.do 的请求过滤并且走设置的过滤方法 --> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> <filter-mapping> <!--只对/0/目录下的文件进行登录过滤 --> <filter-name>LoginFilter</filter-name> <url-pattern>/0/*</url-pattern> </filter-mapping> <listener> <!--监听器配置,监听key登录时候的请求 --> <listener-class> com.futuresoftware.leadinfo.sso.login.SSOsession </listener-class> </listener> <servlet> <servlet-name>PropertiesListener</servlet-name> <servlet-class> com.futuresoftware.ccmbam.synchronization.PropertiesListener </servlet-class> <!--启动容器的时候经过多久启动 servlet --> <load-on-startup>6</load-on-startup> </servlet> <servlet> <servlet-name>SpringContextServlet</servlet-name> <servlet-class> org.springframework.web.context.ContextLoaderServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>action</servlet-name> <servlet-class> org.apache.struts.action.ActionServlet </servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>3</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>3</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet> <servlet-name>InitPropertiesServlet</servlet-name> <servlet-class> com.futuresoftware.ccmbam.setting.InitPropertiesServlet </servlet-class> <!--servlet的初始化参数 --> <init-param> <param-name> com.futuresoftware.ccmcms.properties </param-name> <!--传入的初始化参数值 --> <param-value>/WEB-INF/ccmcms.properties</param-value> </init-param> <!--启动顺序 --> <load-on-startup>4</load-on-startup> </servlet> <servlet> <!--模板引擎配置的servlet --> <servlet-name>velocity</servlet-name> <servlet-class> org.apache.velocity.tools.view.servlet.VelocityViewServlet </servlet-class> <init-param> <!--给模板引擎servlet传入的参数值 --> <param-name>org.apache.velocity.toolbox</param-name> <param-value>/WEB-INF/toolbox.xml</param-value> </init-param> <init-param> <param-name>org.apache.velocity.properties</param-name> <param-value>/WEB-INF/ccmcms.properties</param-value> </init-param> <load-on-startup>10</load-on-startup> </servlet> <servlet> <!--ajax框架 dwr配置 --> <servlet-name>dwr-invoker</servlet-name> <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> <load-on-startup>5</load-on-startup> </servlet> <servlet> <servlet-name>toHtml</servlet-name> <servlet-class> com.futuresoftware.portal.servlet.JspTransToHtmlServlet </servlet-class> </servlet> <servlet> <servlet-name>ForwardApp</servlet-name> <servlet-class> com.futuresoftware.leadinfo.sso.login.ForwardApp </servlet-class> </servlet> <!-- FCKEditor start --> <servlet> <servlet-name>Connector</servlet-name> <servlet-class> net.fckeditor.connector.ConnectorServlet </servlet-class> <init-param> <param-name>baseDir</param-name> <param-value>/uploadfile/</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- FCKEditor end --> <!-- RTX servlet begin --> <servlet> <servlet-name>RTX</servlet-name> <servlet-class>rtx.RTX</servlet-class> </servlet> <servlet-mapping> <servlet-name>RTX</servlet-name> <url-pattern>/RTX</url-pattern> </servlet-mapping> <!-- RTX servlet end --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>dwr-invoker</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>toHtml</servlet-name> <url-pattern>/toHtml</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>velocity</servlet-name> <url-pattern>*.vm</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>InitPropertiesServlet</servlet-name> <url-pattern>/initProperties</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ForwardApp</servlet-name> <url-pattern>/ForwardApp.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Connector</servlet-name> <url-pattern> /fckeditor/editor/filemanager/connectors/* </url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>/sso/dl.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>500</error-code> <location>/locationError.jsp</location> </error-page> <error-page> <error-code>404</error-code> <location>/locationError1.jsp</location> </error-page> <!-- Struts Tag Library Descriptors --> <taglib> <!--标签库描述符 --> <taglib-uri>/taglib/struts-bean</taglib-uri> <taglib-location> /WEB-INF/taglib/struts-bean.tld </taglib-location> </taglib> <taglib> <taglib-uri>/taglib/struts-html</taglib-uri> <taglib-location> /WEB-INF/taglib/struts-html.tld </taglib-location> </taglib> <taglib> <taglib-uri>/taglib/struts-logic</taglib-uri> <taglib-location> /WEB-INF/taglib/struts-logic.tld </taglib-location> </taglib> <taglib> <taglib-uri>/taglib/struts-nested</taglib-uri> <taglib-location> /WEB-INF/taglib/struts-nested.tld </taglib-location> </taglib> <taglib> <taglib-uri>/taglib/struts-template</taglib-uri> <taglib-location> /WEB-INF/taglib/struts-template.tld </taglib-location> </taglib> <taglib> <taglib-uri>/taglib/struts-tiles</taglib-uri> <taglib-location> /WEB-INF/taglib/struts-tiles.tld </taglib-location> </taglib> <taglib> <taglib-uri>http://java.sun.com/jstl/core</taglib-uri> <taglib-location>/WEB-INF/c-1_0.tld</taglib-location> </taglib> </web-app> |
|||
Users.xml | xmlapi | ||
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd"> <mapper namespace="Users"> <select id="getCountOfUsers" parameterType="org.users.vo.UserModel" resultType="java.lang.Integer"> select count(*) from users where user_name = #{userName, jdbcType=VARCHAR} </select> <select id="getUserByPK" parameterType="org.users.vo.UserModel" resultType="org.users.vo.UserModel"> select * from users where user_id = #{userId, jdbcType=NUMERIC} </select> </mapper> |
|||
UserInfoMapper.xml | xmlapi | ||
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd"> <!-- 该文件通过代码生成器自动生成,只需编写模板,可以生成任何代码 具体请查看: http://code.google.com/p/rapid-framework/ author badqiu email:badqiu(a)gmail.com --> <mapper namespace="UserInfo"> <resultMap id="UserInfoResult" type="com.company.project.model.UserInfo"> </resultMap> <!-- 用于select查询公用抽取的列 --> <sql id="commonColumns"> <![CDATA[ user_id as userId, username as username, password as password, birth_date as birthDate, sex as sex, age as age ]]> </sql> <!-- useGeneratedKeys="true" keyProperty="xxx" for sqlserver and mysql --> <insert id="insert" parameterType="com.company.project.model.UserInfo" useGeneratedKeys="true" keyProperty="userId" > <![CDATA[ INSERT INTO user_info ( user_id , username , password , birth_date , sex , age ) VALUES ( #{userId,jdbcType=BIGINT} , #{username,jdbcType=VARCHAR} , #{password,jdbcType=VARCHAR} , #{birthDate,jdbcType=DATE} , #{sex,jdbcType=TINYINT} , #{age,jdbcType=INTEGER} ) ]]> <!-- oracle: order="BEFORE" SELECT sequenceName.nextval AS ID FROM DUAL DB2: order="BEFORE"" values nextval for sequenceName <selectKey resultType="java.lang.Long" order="BEFORE" keyProperty="userId"> SELECT sequenceName.nextval AS ID FROM DUAL </selectKey> --> </insert> <update id="update" parameterType="com.company.project.model.UserInfo"> <![CDATA[ UPDATE user_info SET username = #{username,jdbcType=VARCHAR} , password = #{password,jdbcType=VARCHAR} , birth_date = #{birthDate,jdbcType=DATE} , sex = #{sex,jdbcType=TINYINT} , age = #{age,jdbcType=INTEGER} WHERE user_id = #{userId} ]]> </update> <delete id="delete" parameterType="java.lang.Long"> <![CDATA[ delete from user_info where user_id = #{id} ]]> </delete> <select id="getById" parameterType="java.lang.Long" resultMap="UserInfoResult"> select <include refid="commonColumns" /> <![CDATA[ from user_info where user_id = #{id} ]]> </select> <sql id="dynamicWhere"> <where> <if test="userId != null"> and user_id = #{userId} </if> <if test="username != null"> and username = #{username} </if> <if test="password != null"> and password = #{password} </if> <if test="birthDate != null"> and birth_date = #{birthDate} </if> <if test="sex != null"> and sex = #{sex} </if> <if test="age != null"> and age = #{age} </if> </where> </sql> <select id="count" resultType="long"> select count(*) from user_info <include refid="dynamicWhere"/> </select> <!-- 分页查询已经使用Dialect进行分页,也可以不使用Dialect直接编写分页 因为分页查询将传 #offset#,#pageSize#,#lastRows# 三个参数,不同的数据库可以根于此三个参数属性应用不同的分页实现 --> <select id="pageSelect" resultMap="UserInfoResult"> select <include refid="commonColumns" /> from user_info <include refid="dynamicWhere"/> <if test="sortColumns != null and sortColumns.length() != 0"> ORDER BY ${sortColumns} </if> </select> </mapper> |
|||
SqlmapConfiguration.xml | xmlapi | ||
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-config.dtd"> <configuration> <properties resource="conf/database.properties" /> <environments default="development"> <environment id="development"> <transactionManager type="JDBC" /> <dataSource type="POOLED"> <property name="driver" value="${database.driver}"/> <property name="url" value="${database.url}"/> <property name="username" value="${database.user}"/> <property name="password" value="${database.password}"/> </dataSource> </environment> <environment id="development_oracle"> <transactionManager type="JDBC" /> <dataSource type="POOLED"> <property name="driver" value="${oracle.database.driver}"/> <property name="url" value="${oracle.database.url}"/> <property name="username" value="${oracle.database.user}"/> <property name="password" value="${oracle.database.password}"/> </dataSource> </environment> </environments> <mappers> <mapper resource="conf/NewsNotice.xml"/> </mappers> </configuration> |
|||
NewsNotice.xml | xmlapi | ||
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd"> <mapper namespace="NewsNotice"> <resultMap type="org.newsnotice.domain.NewsNoticeModel" id="resultMap-getNewsNotice1"> <id column="NN_ID" property="id" /> <result column="CATEGORY" property="category" /> <result column="SUBJECT" property="subject" /> <result column="POSTED_DATE" property="postedDate" /> <result column="EXPIRY_DATE" property="expiryDate" /> <result column="ALERT" property="alert" /> <result column="EMAIL_ALERT" property="emailAlert" /> <result column="AUDIENCE" property="audience" /> <result column="FILTER" property="filter" /> <result column="FILTER_VALUE" property="filterValue" /> <result column="SUB_FILTER_VALUE" property="subFilterValue" /> <result column="EXCLUDE_USER_ID" property="excludeUserId" /> <result column="WF_DEPARTMENT" property="department" /> <result column="WF_STATUS" property="status" /> <result column="WF_NOTES" property="notes" /> <result column="DEFUNCT_IND" property="defunctInd" /> <result column="APPROVER" property="approver" /> <association property="newsNoticeContent" column="CONTENT_ID" javaType="org.newsnotice.domain.NewsNoticeContentModel"> <id column="CONTENT_ID" property="id" /> <result column="PARENT_NN_ID" property="parentId" /> <result column="CONTENT" property="content" /> </association> <collection property="newsNoticeMsgBoxList" ofType="org.newsnotice.domain.NewsNoticeMsgBoxModel" > <id column="MSG_BOX_ID" property="id"/> <result column="USER_ID" property="userId" /> <result column="MSG_BOX_NN_ID" property="nnId" /> <result column="FOLDER" property="folder" /> <result column="READ" property="read" /> <result column="READ_ON" property="readOn" /> <result column="MSG_BOX_DEFUNCT_IND" property="defunctInd" /> <result column="MSG_BOX_PI_NO" property="piNo" /> </collection> </resultMap> <select id="getNewsNotice" parameterType="org.newsnotice.domain.NewsNoticeModel" resultMap="resultMap-getNewsNotice1" > SELECT A.NN_ID, A.CATEGORY, A.SUBJECT, A.POSTED_DATE, A.EXPIRY_DATE, A.ALERT, A.EMAIL_ALERT, A.AUDIENCE, A.FILTER, A.FILTER_VALUE, A.SUB_FILTER_VALUE, A.EXCLUDE_USER_ID, A.WF_DEPARTMENT, A.WF_STATUS, A.WF_NOTES, A.DEFUNCT_IND, A.APPROVER, B.ID CONTENT_ID, B.PARENT_NN_ID, B.CONTENT, C.ID MSG_BOX_ID, C.USER_ID, C.NN_ID MSG_BOX_NN_ID, C.FOLDER, C.READ, C.READ_ON, C.DEFUNCT_IND MSG_BOX_DEFUNCT_IND, C.PI_NO MSG_BOX_PI_NO FROM NN_MSTR A, NN_CONTENT B, NN_MSG_BOX C WHERE A.NN_ID = B.PARENT_NN_ID AND A.NN_ID = C.NN_ID <if test="id != null"> AND A.NN_ID = #{id} </if> <if test="category != null"> AND A.CATEGORY = #{category} </if> <if test="status != null"> AND A.WF_STATUS = #{status} </if> </select> <resultMap type="org.newsnotice.domain.NewsNoticeModel" id="resultMap-getNewsNotice2"> <id column="NN_ID" property="id" /> <result column="CATEGORY" property="category" /> <result column="SUBJECT" property="subject" /> <result column="POSTED_DATE" property="postedDate" /> <result column="EXPIRY_DATE" property="expiryDate" /> <result column="ALERT" property="alert" /> <result column="EMAIL_ALERT" property="emailAlert" /> <result column="AUDIENCE" property="audience" /> <result column="FILTER" property="filter" /> <result column="FILTER_VALUE" property="filterValue" /> <result column="SUB_FILTER_VALUE" property="subFilterValue" /> <result column="EXCLUDE_USER_ID" property="excludeUserId" /> <result column="WF_DEPARTMENT" property="department" /> <result column="WF_STATUS" property="status" /> <result column="WF_NOTES" property="notes" /> <result column="DEFUNCT_IND" property="defunctInd" /> <result column="APPROVER" property="approver" /> <association property="newsNoticeContent" column="CONTENT_ID" javaType="org.newsnotice.domain.NewsNoticeContentModel" resultMap="resultMap-content" /> <collection property="newsNoticeMsgBoxList" ofType="org.newsnotice.domain.NewsNoticeMsgBoxModel" resultMap="resultMap-msgbox" /> </resultMap> <resultMap type="org.newsnotice.domain.NewsNoticeContentModel" id="resultMap-content"> <id column="CONTENT_ID" property="id" /> <result column="PARENT_NN_ID" property="parentId" /> <result column="CONTENT" property="content" /> </resultMap> <resultMap type="org.newsnotice.domain.NewsNoticeMsgBoxModel" id="resultMap-msgbox"> <id column="MSG_BOX_ID" property="id"/> <result column="USER_ID" property="userId" /> <result column="MSG_BOX_NN_ID" property="nnId" /> <result column="FOLDER" property="folder" /> <result column="READ" property="read" /> <result column="READ_ON" property="readOn" /> <result column="MSG_BOX_DEFUNCT_IND" property="defunctInd" /> <result column="MSG_BOX_PI_NO" property="piNo" /> </resultMap> </mapper> |
|||
hibernate-context | xmlapi | ||
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd" <beans> <!-- Configurer that replaces ${...} placeholders with values from a properties file --> <bean id="propertyConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>/WEB-INF/ccmcms.properties</value> </property> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" > <property name="driverClassName"> <value>${hibernate.connection.driver_class}</value> </property> <property name="url"> <value>${hibernate.connection.url}</value> </property> <property name="username"> <value>${hibernate.connection.username}</value> </property> <property name="password"> <value>${hibernate.connection.password}</value> </property> </bean> <!-- bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" > <property name="jndiName"> <value>java:comp/env/jdbc/appDS</value> </property> </bean> --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource" /> </property> <property name="mappingResources"> <list> <value>com/futuresoftware/ccmbam/model/Sequenceblock.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Website.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Columninfo.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Content.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Contenttype.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Fucdefine.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Template.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Account.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Cmsuser.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Department.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Userrole.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Flowdefine.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Flowtask.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Role.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Rolefucperm.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Deptcolumn.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Roleflowtask.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Contentflowtask.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Accesstotal.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Getremote.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Votequestion.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Voteanswer.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Voteresult.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Letterdata.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Govfilecontent.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Govfiletype.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Govfileunitcalling.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Govfilewenzhong.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Govtypedept.hbm.xml</value> <!--value>com/futuresoftware/ccmbam/model/Plancontent.hbm.xml</value> --> <value>com/futuresoftware/ccmbam/model/Sxzbcontent.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Sxzbtype.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Contenttotal.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Gwyjczzb.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Gwypxhsj.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Telphone.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/TelOrg.hbm.xml</value> <!-- leiming shu_ju_jiao_huan 2009/10/17 --> <value>com/futuresoftware/leadinfo/sso/model/Ysdwzlsbhsl.hbm.xml</value> <value>com/futuresoftware/leadinfo/sso/model/Yszwzlsbhsl.hbm.xml</value> <!-- leiming end --> <!-- litao begin 2010-4-2 <value>com/futuresoftware/ccmbam/model/Roletype.hbm.xml</value> --> <value>com/futuresoftware/ccmbam/model/Userdepartment.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Ugroup.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Usergroup.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Usercolumn.hbm.xml</value> <value>com/futuresoftware/ccmbam/model/Columngroup.hbm.xml</value> <!-- litao end --> <!-- wubo --> <value>com/futuresoftware/ccmbam/model/AccessNum.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <!-- prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> --> <prop key="hibernate.show_sql"> false </prop> <!-- prop key="hibernate.default_schema"> xdb </prop--> <!-- 主要设置hibernate 缓存和批处理的大--> <prop key="hibernate.hbm2ddl.auto"> update </prop> <prop key="hibernate.jdbc.batch_versioned_data">true</prop> <!-- <prop key="hibernate.connection.provider_class">net.sf.hibernate.connection.DatasourceConnectionProvider</prop> <prop key="hibernate.cache.provider_class">net.sf.hibernate.cache.EhCacheProvider</prop> --> <prop key="hibernate.jdbc.fetch_size">50</prop> <prop key="hibernate.jdbc.batch_size">20</prop> </props> </property> <property name="lobHandler"><ref local="myLobHandler"/></property> </bean> <!--chuli-clob --> <bean id="myLobHandler" class="com.futuresoftware.ccmbam.util.MyLobHandler" > <property name="oracleLobHandler"><ref local="oracleLobHandler"/></property> <property name="defaultLobHandler"><ref local="defaultLobHandler"/></property> <property name="dataBaseType"><value>${hibernate.dialect}</value></property> </bean> <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler"> <property name="nativeJdbcExtractor"><ref local="nativeJdbcExtractor"/></property> </bean> <bean id="defaultLobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler"> </bean> <bean id="nativeJdbcExtractor" class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor"> </bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory"><ref bean="sessionFactory"/></property> </bean> <!--DAO Layer Deploy--> <bean id="baseDao" class="com.futuresoftware.ccmbam.daoimpl.PersistentBaseDaoImpl"> <property name="hibernateTemplate"><ref bean="hibernateTemplate"/></property> </bean> <!--DAO Layer Deploy--> <!--UUM用户数据同步--> <bean id="synTarget" class="com.futuresoftware.leadinfo.sso.syn.SynInfoImpl"> <property name="pbdao"><ref bean="baseDao"/></property> </bean> <bean id="syn" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="synTarget"/></property> <property name="transactionAttributes"> <props> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="syn*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--UUM用户数据同步--> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory" /> </property> </bean> <!--Option Logic Layer Deploy--> <!--Logic Base Bean--> <bean id="baseLogicTarget" class="com.futuresoftware.ccmbam.beanimpl.LogicBaseBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="baseLogic" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="baseLogicTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--Logic Base Bean--> <bean id="websiteTarget" class="com.futuresoftware.ccmbam.beanimpl.WebsiteBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="website" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="websiteTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--栏目业务逻辑--> <bean id="columninfoTarget" class="com.futuresoftware.ccmbam.beanimpl.ColumninfoBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="columninfo" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="columninfoTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--内容业务逻辑--> <bean id="contentTarget" class="com.futuresoftware.ccmbam.beanimpl.ContentBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="content" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="contentTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--内容类型业务逻辑--> <bean id="contenttyypeTarget" class="com.futuresoftware.ccmbam.beanimpl.ContenttypeBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="contenttyype" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="contenttyypeTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--模板业务逻辑--> <bean id="templementTarget" class="com.futuresoftware.ccmbam.beanimpl.TemplementBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="templement" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="templementTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--流程节点业务逻辑--> <bean id="flowtaskTarget" class="com.futuresoftware.ccmbam.beanimpl.FlowtaskBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="flowtask" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="flowtaskTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--角色业务逻辑--> <bean id="roleTarget" class="com.futuresoftware.ccmbam.beanimpl.RoleBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="role" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="roleTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--内容流程节点业务逻辑--> <bean id="contentflowtaskTarget" class="com.futuresoftware.ccmbam.beanimpl.ContentFlowtaskImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="contentflowtask" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="contentflowtaskTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--统计业务逻辑--> <bean id="statistTarget" class="com.futuresoftware.ccmbam.beanimpl.StatistBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="statist" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="statistTarget"/></property> <property name="transactionAttributes"> <props> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--部门业务逻辑--> <bean id="departmentTarget" class="com.futuresoftware.ccmbam.beanimpl.DepartmentBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="department" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="departmentTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="dept*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--帐号业务逻辑--> <bean id="accountTarget" class="com.futuresoftware.ccmbam.beanimpl.AccountBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="account" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="accountTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="account*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--流程业务逻辑--> <bean id="flowdefineTarget" class="com.futuresoftware.ccmbam.beanimpl.FlowdefineBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="flowdefine" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="flowdefineTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--个人业务逻辑--> <bean id="personTarget" class="com.futuresoftware.ccmbam.beanimpl.PersonBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="person" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="personTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--Luence搜索业务逻辑--> <bean id="searchTarget" class="com.futuresoftware.ccmbam.beanimpl.SearchBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="search" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="searchTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--在线调查业务逻辑--> <bean id="voteTarget" class="com.futuresoftware.ccmbam.beanimpl.VoteBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="vote" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="voteTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="account*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--邮件处理业务逻辑--> <bean id="letterTarget" class="com.futuresoftware.ccmbam.beanimpl.LetterBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="letter" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="letterTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="account*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="accesstotalTarget" class="com.futuresoftware.ccmbam.beanimpl.AccesstotalBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="accesstotal" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="accesstotalTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="fucdeTarget" class="com.futuresoftware.ccmbam.beanimpl.FucdefineBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="fucdefine" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="fucdeTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- 政府文件类型管理 --> <bean id="govfileTarget" class="com.futuresoftware.ccmbam.beanimpl.GovfiletypeBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="govfiletype" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="govfileTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="account*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="govfileCallTarget" class="com.futuresoftware.ccmbam.beanimpl.GovfileunitcallingBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="govfilecall" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="govfileCallTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="account*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="govfilewenzTarget" class="com.futuresoftware.ccmbam.beanimpl.GovfilewenzhongBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="govfilewebzong" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="govfilewenzTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="account*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="govfilecontentTarget" class="com.futuresoftware.ccmbam.beanimpl.GovfilecontentBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="govfilecontent" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="govfilecontentTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="account*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--bean id="plancontentTarget" class="com.futuresoftware.ccmbam.beanimpl.PlancontentBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="plancontent" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="plancontentTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="account*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> --> <bean id="sxzbtypeTarget" class="com.futuresoftware.ccmbam.beanimpl.SxzbtypeBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="sxzbtype" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="sxzbtypeTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="sxzbcontentTarget" class="com.futuresoftware.ccmbam.beanimpl.SxzbcontentBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="sxzbcontent" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="sxzbcontentTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- linye litao --> <bean id="contentinfoTarget" class="com.futuresoftware.leadinfo.beanimpl.ContentBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="contentinfo" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="contentinfoTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="sel*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="ptinfoTarget" class="com.futuresoftware.leadinfo.sso.pt.PTbeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="ptinfo" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="ptinfoTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="leadinfoTarget" class="com.futuresoftware.leadinfo.beanimpl.LeadInfoBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="leadinfo" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="leadinfoTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="sel*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <bean id="dwrcontloadTarget" class="com.futuresoftware.leadinfo.util.DwrOnLoadImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="dwrcontload" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="dwrcontloadTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="sel*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="getInfo*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- <bean id="roletypeTarget" class="com.futuresoftware.ccmbam.beanimpl.RoletypeBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="roletype" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="roletypeTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="sel*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> --> <!--电话本业务逻辑--> <bean id="telphoneTarget" class="com.futuresoftware.ccmbam.beanimpl.TelphoneBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="telphone" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="telphoneTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!--电话本实时同步机构信息业务逻辑--> <bean id="telorgTarget" class="com.futuresoftware.ccmbam.beanimpl.TelOrgBeanImpl"> <property name="baseDao"><ref local="baseDao"/></property> </bean> <bean id="telorg" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="telorgTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED</prop> <prop key="list*">PROPAGATION_REQUIRED</prop> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="modify*">PROPAGATION_REQUIRED</prop> <prop key="del*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> <!-- linye litao end --> </beans> |
|||
q我吧 | q我吧 | <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=654945833&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:654945833:43" alt="我是徐士刚" title="我是徐士刚"></a> | |
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=654945833&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:654945833:43" alt="我是徐士刚" title="我是徐士刚"></a> |
|||
过滤器实现session过期跳转到主页 | |||
package com.futuresoftware.leadinfo.sso.filter; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class LoginFilter implements Filter { public void init(FilterConfig fc) throws ServletException { } public void doFilter(ServletRequest req, ServletResponse res,FilterChain chain) throws IOException, ServletException { HttpServletRequest request=(HttpServletRequest)req; HttpServletResponse response=(HttpServletResponse)res; HttpSession session = request.getSession(); if(session.getAttribute("userIP")==null){ response.sendRedirect(request.getContextPath()+"/index.jsp"); }else{ chain.doFilter(req, res); } } public void destroy() { } } |
|||
用HttpSessionListener与HttpSessionBindingListener实现在线人数统计 | 在线人数统计 | 用HttpSessionListener与HttpSessionBindingListener实现在线人数统计 | |
下午比较闲(其实今天都很闲),想了一下在线人数统计方面的实现,上网找了下这方面的知识,最初我的想法是,管理session,如果session销毁了就减少,如果登陆用户了就新增一个,但是如果是用户非法退出,如:未注销,关闭浏览器等,这个用户的session是管理不到的,最后决定用HttpSessionListener接口或HttpSessionBindingListener接口来实现,通过监听session的新建和销毁来控制,详细如下。 先添加登陆的页面index.jsp view sourceprint? <%@ page contentType="text/html;charset=utf-8"%> <html> <head> <title>test</title> </head> <body> <form action="login.jsp" method="post"> 用户名:<input type="text" name="username" /> <br /> <input type="submit" value="登录" /> </form> </body> </html> 点击登陆后跳转的login.jsp(为了方便,用jsp做servlet,同学们用的时候记得改过来) view sourceprint?01 <%@ page contentType="text/html;charset=utf-8"%> 02 <%@ page import="java.util.*"%> 03 <% 04 request.setCharacterEncoding("UTF-8"); 05 // 取得登录的用户名 06 String username = request.getParameter("username"); 07 // 把用户名保存进session 08 session.setAttribute("username", username); 09 // 把用户名放入在线列表 10 List onlineUserList = (List) application.getAttribute("onlineUserList"); 11 // 第一次使用前,需要初始化 12 if (onlineUserList == null) { 13 onlineUserList = new ArrayList(); 14 application.setAttribute("onlineUserList", onlineUserList); 15 } 16 onlineUserList.add(username); 17 // 成功 18 response.sendRedirect("result.jsp"); 19 %> 登陆成功跳转到显示页面result.jsp view sourceprint?1 <%@ page contentType="text/html;charset=utf-8"%> 2 <%@ page isELIgnored="false"%> 3 <%@page import="java.util.List"%> view sourceprint?01 <h3>您好:${username} [<a href="logout.jsp">注销</a>]</h3> 02 当前在线用户: 03 <table> 04 <% 05 List onlineUserList = (List) application.getAttribute("onlineUserList"); 06 for (int i = 0; i < onlineUserList.size(); i++) { 07 String onlineUsername = (String) onlineUserList.get(i); 08 %> 09 <tr> 10 <td><%=onlineUsername%></td> 11 </tr> 12 <% 13 } 14 %> 15 </table> 点击注销页面logout.jsp页面 view sourceprint?01 <%@ page contentType="text/html;charset=utf-8"%> 02 <%@ page import="java.util.*"%> 03 <% 04 // 取得登录的用户名 05 String username = (String) session.getAttribute("username"); 06 // 销毁session 07 session.invalidate(); 08 // 从在线列表中删除用户名 09 List onlineUserList = (List) application.getAttribute("onlineUserList"); 10 onlineUserList.remove(username); 11 // 成功 12 response.sendRedirect("index.jsp"); 13 %> OK,登陆、查看、注销页面都有了,下面开始新建监听器 1、HttpSessionListener 添加类OnlineUserListener,继承HttpSessionListener,HttpSessionListener中有两个方法sessionCreated(HttpSessionEvent event)与sessionDestroyed(HttpSessionEvent event),前者是监听session的新建,后者是监听session的销毁。 OnlineUserListener代码如下: view sourceprint?01 package com.test; 02 03 import java.util.List; 04 import javax.servlet.ServletContext; 05 import javax.servlet.http.HttpSession; 06 import javax.servlet.http.HttpSessionEvent; 07 import javax.servlet.http.HttpSessionListener; 08 /** 09 * @author 版本 10 */ 11 public class OnlineUserListener implements HttpSessionListener { 12 13 public void sessionCreated(HttpSessionEvent event) { 14 System.out.println("新建session:"+event.getSession().getId()); 15 } 16 public void sessionDestroyed(HttpSessionEvent event) { 17 HttpSession session = event.getSession(); 18 ServletContext application = session.getServletContext(); 19 // 取得登录的用户名 20 String username = (String) session.getAttribute("username"); 21 // 从在线列表中删除用户名 22 List onlineUserList = (List) application.getAttribute("onlineUserList"); 23 onlineUserList.remove(username); 24 System.out.println(username+"已经退出!"); 25 } 26 } web.xml配置: view sourceprint?1 <listener> 2 <listener-class>com.test.OnlineUserListener</listener-class> 3 </listener> 一旦监听器发现调用了sessionDestoryed方法就会把其用户从在线人数中delete,在下面两种情况下会发生sessionDestoryed事件 a.执行session.invalidate()方法时 logout.jsp中调用了 session.invalidate()方法 b.session会话超时 session的默认超时事件是30分钟,30分钟后自动销毁session 2、HttpSessionBindingListener HttpSessionBindingListener虽然叫做监听器,但使用方法与HttpSessionListener完全不同。我们实际看一下它是如何使用的。 新建类OnlineUserBindingListener,实现HttpSessionBindingListener接口,构造方法传入username参数,HttpSessionBindingListener内有两个方法valueBound(HttpSessionBindingEvent event)和valueUnbound(HttpSessionBindingEvent event),前者为数据绑定,后者为取消绑定 所谓对session进行数据绑定,就是调用session.setAttribute()把HttpSessionBindingListener保存进session中。 在login.jsp中做这一步: view sourceprint?01 <%@page import="com.test.OnlineUserBindingListener"%> 02 <%@ page contentType="text/html;charset=utf-8"%> 03 <%@ page import="java.util.*"%> 04 <% 05 request.setCharacterEncoding("UTF-8"); 06 // 取得登录的用户名 07 String username = request.getParameter("username"); 08 // 把用户名放入在线列表 09 session.setAttribute("onlineUserBindingListener", new OnlineUserBindingListener(username)); 10 // 成功 11 response.sendRedirect("result.jsp"); 12 %> 这就是HttpSessionBindingListener和HttpSessionListener之间的最大区别:HttpSessionListener只需要设置到web.xml中就可以监听整个应用中的所有session。HttpSessionBindingListener必须实例化后放入某一个session中,才可以进行监听。 从监听范围上比较,HttpSessionListener设置一次就可以监听所有session,HttpSessionBindingListener通常都是一对一的。 正是这种区别成就了HttpSessionBindingListener的优势,我们可以让每个listener对应一个username,这样就不需要每次再去session中读取username,进一步可以将所有操作在线列表的代码都移入listener,更容易维护。 HttpSessionBindingListener代码如下: view sourceprint?01 package com.test; 02 03 import java.util.ArrayList; 04 import java.util.List; 05 import javax.servlet.ServletContext; 06 import javax.servlet.http.HttpSession; 07 import javax.servlet.http.HttpSessionBindingEvent; 08 import javax.servlet.http.HttpSessionBindingListener; 09 10 public class OnlineUserBindingListener implements HttpSessionBindingListener { 11 String username; 12 13 public OnlineUserBindingListener(String username){ 14 this.username=username; 15 } 16 public void valueBound(HttpSessionBindingEvent event) { 17 HttpSession session = event.getSession(); 18 ServletContext application = session.getServletContext(); 19 // 把用户名放入在线列表 20 List onlineUserList = (List) application.getAttribute("onlineUserList"); 21 // 第一次使用前,需要初始化 22 if (onlineUserList == null) { 23 onlineUserList = new ArrayList(); 24 application.setAttribute("onlineUserList", onlineUserList); 25 } 26 onlineUserList.add(this.username); 27 } 28 29 public void valueUnbound(HttpSessionBindingEvent event) { 30 HttpSession session = event.getSession(); 31 ServletContext application = session.getServletContext(); 32 33 // 从在线列表中删除用户名 34 List onlineUserList = (List) application.getAttribute("onlineUserList"); 35 onlineUserList.remove(this.username); 36 System.out.println(this.username + "退出。"); 37 38 } 39 40 } 这里可以直接使用listener的username操作在线列表,不必再去担心session中是否存在username。 valueUnbound的触发条件是以下三种情况: a.执行session.invalidate()时。 b.session超时,自动销毁时。 c.执行session.setAttribute("onlineUserListener", "其他对象");或session.removeAttribute("onlineUserListener");将listener从session中删除时。 因此,只要不将listener从session中删除,就可以监听到session的销毁。 分类: About Work 标签: 在线人数统计, HttpSessionListener, HttpSessionBindingListener |
|||
简单方式记录访问量 | |||
package webbook.chapter14; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; public class CounterListener implements HttpSessionListener { private static long onlineNumber = 0; public static long getOnlineNumber() { return onlineNumber; } public void sessionCreated(HttpSessionEvent se) { onlineNumber++; } public void sessionDestroyed(HttpSessionEvent se) { onlineNumber--; } } |
|||
登陆验证及安全认证 | |||
package com.futuresoftware.ccmbam.action; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.futuresoftware.ccmbam.action.BaseDispatchAction; import com.futuresoftware.ccmbam.bean.AccountBean; import com.futuresoftware.ccmbam.bean.CmsuserBean; import com.futuresoftware.ccmbam.bean.ColumninfoBean; import com.futuresoftware.ccmbam.bean.DepartmentBean; import com.futuresoftware.ccmbam.beanimpl.AccountBeanImpl; import com.futuresoftware.ccmbam.beanimpl.CmsuserBeanImpl; import com.futuresoftware.ccmbam.dao.PersistentBaseDao; import com.futuresoftware.ccmbam.model.Account; import com.futuresoftware.ccmbam.model.Cmsuser; import com.futuresoftware.ccmbam.model.Department; import com.futuresoftware.ccmbam.model.Fucdefine; import com.futuresoftware.ccmbam.util.Page; import com.futuresoftware.portal.util.MD5; /** * 主要功能:进行登陆验证 * * */ public class IndexAction extends BaseDispatchAction { Page page = new Page(); CmsuserBean cbean = new CmsuserBeanImpl(); @SuppressWarnings("unchecked") public ActionForward AccountLogin(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException { int pageNo = 1; Object obj[] = null; ActionMessages errors = new ActionMessages(); ActionForward forward = new ActionForward(); try { HttpSession session = request.getSession(); PersistentBaseDao dao = (PersistentBaseDao) wac.getBean("baseDao"); AccountBean accountbean = new AccountBeanImpl(); ColumninfoBean columninfobean = (ColumninfoBean) wac.getBean("columninfo"); obj = new Object[2]; obj[0] = request.getParameter("loginname"); obj[1] = MD5.toMD5(request.getParameter("loginpassword")); @SuppressWarnings("unused") List columnlist; /*********************************/ Map map = new HashMap(); if (accountbean.accountLoginCheck(dao, obj, pageNo, 10)!=null) { map = (HashMap) accountbean.accountLoginCheck(dao, obj, pageNo, 10); }else{ try { throw new Exception("future.system.loginerror"); } catch (Exception ex) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("future.system.loginerror")); } saveErrors(request, errors); return new ActionForward(mapping.getInput()); } Page page = (Page) map.get("page"); Map map1 = (Map) map.get("map"); List roleList = (List)map1.get("rolelist"); if(this.ifAdmin(roleList)){ session.setMaxInactiveInterval(-1);//session设为永不过期。 } columnlist = columninfobean.getUserColumn((List)map1.get("columnlist")); // columnlist = columninfobean.getUserColumn(columnlist); // 将返回的信息存入session中以便以后用到 session.setAttribute("rolelist", map1.get("rolelist")); session.setAttribute("deptlist", map1.get("deptlist")); session.setAttribute("columnlist", columnlist); session.setAttribute("user", map1.get("user")); session.setAttribute("account", map1.get("account")); // 每次登录之后更新帐号表中最后登陆时间与主机IP Account account = (Account) request.getSession().getAttribute( "account"); if (account == null) { throw new Exception("LoginError"); } Account cccount = (Account) baseLogic.getModelDetail(Account.class, account.getId()); cccount.setHostIp(request.getRemoteHost()); cccount.setLastlogintime(new Date()); baseLogic.modifyModel(cccount); if (page == null || page.getDataList().size() == 0) { try { throw new Exception("future.system.loginnorole"); } catch (Exception ex) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("future.system.loginnorole")); } } String accout = getAccount(page.getDataList()); // String stop = "</span></td></tr>"; // if(cccount.getId().intValue() == 1){ // accout = accout + "<tr><td align='left' style=' cursor:hand; font-size:12px' width='143' background='../images/left-bg.jpg' bgcolor='#3E70A6' height='30'> " // + "<font color='#000000'> <img src='../images/sub1_001.gif' border='0' width='16' height='16'> <font onclick=\"parent.mainFrame.location.replace('/ccmbam/syncfile/uploadsyncfile.jsp');\">文件同步管理器</font>"; // //// accout = accout + "<tr><td align='left' style=' cursor:hand; font-size:12px' width='143' background='../images/left-bg.jpg' bgcolor='#3E70A6' height='30'> <img src='../images/sub2.gif' border='0'><a href='#g' " + //// "onclick='parent.mainFrame.location.replace(this.href);' style='text-decoration: none; font-size: 12px'> " //// + "上传文件</a><br> "; // } accout += stop; session.setAttribute("roleleft", accout); } catch (Exception ex) { log.error("LoginError"); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage( "future.system.loginnorole")); request.setAttribute("logerror", "loginpage"); } if (!errors.isEmpty()) { saveErrors(request, errors); forward = new ActionForward(mapping.getInput()); } else { forward = new ActionForward(mapping.findForward("AccountLogin") .getPath()); } return forward; } @SuppressWarnings("unchecked") public ActionForward AccountLogin1(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException { int pageNo = 1; DepartmentBean dbean = (DepartmentBean) wac.getBean("department"); ColumninfoBean columninfobean = (ColumninfoBean) wac.getBean("columninfo"); Object obj[] = null; ActionMessages errors = new ActionMessages(); ActionForward forward = new ActionForward(); try { HttpSession session = request.getSession(true); // String code = (String) session.getAttribute("rand"); // String codeinput = request.getParameter("code"); // if (!codeinput.equals (code)){ // errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("future.system.logincodeerror") ); // } PersistentBaseDao dao = (PersistentBaseDao) wac.getBean("baseDao"); AccountBean accountbean = new AccountBeanImpl(); Cmsuser cms = (Cmsuser) session.getAttribute("cms"); Cmsuser user = cbean.getCmsuser(dao, cms.getUsername()); obj = new Object[2]; obj[0] = user.getUsername(); obj[1] = MD5.toMD5(user.getUsername()); /**********得到当前用户的部门*********/ Department org = (Department)request.getSession().getAttribute("org"); Department dept = dbean.getDepartment(org.getDeptname()); List deptlist = new ArrayList(); deptlist.add(dept.getId()); List columnlist; @SuppressWarnings("unused") Map map = new HashMap(); if (accountbean.accountLoginCheck(dao, obj, pageNo, 10)!=null) { map = (HashMap) accountbean.accountLoginCheck(dao, obj, pageNo, 10); columnlist = accountbean.getDeptColumn(dao,dept.getId()); columnlist = columninfobean.getUserColumn(columnlist); }else{ try { throw new Exception("future.system.loginerror"); } catch (Exception ex) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("future.system.loginerror")); } saveErrors(request, errors); return new ActionForward(mapping.getInput()); } Page page = (Page) map.get("page"); Map map1 = (Map) map.get("map"); List roleList = (List)map1.get("rolelist"); if(this.ifAdmin(roleList)){ session.setMaxInactiveInterval(-1); } // 将返回的信息存入session中以便以后用到 request.getSession().setAttribute("rolelist", map1.get("rolelist")); request.getSession().setAttribute("deptlist", deptlist); request.getSession().setAttribute("columnlist", columnlist); request.getSession().setAttribute("user", user); request.getSession().setAttribute("account", map1.get("account")); // 每次登录之后更新帐号表中最后登陆时间与主机IP Account account = (Account) request.getSession().getAttribute( "account"); if (account == null) { throw new Exception("LoginError"); } Account cccount = (Account) baseLogic.getModelDetail(Account.class, account.getId()); cccount.setHostIp(request.getRemoteHost()); cccount.setLastlogintime(new Date()); baseLogic.modifyModel(cccount); if (page == null || page.getDataList().size() == 0) { try { throw new Exception("future.system.loginnorole"); } catch (Exception ex) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("future.system.loginnorole")); } } String accout = getAccount(page.getDataList()); // String stop = "</span></td></tr>"; // if(cccount.getId().intValue() == 1){ // accout = accout + "<tr><td align='left' style=' cursor:hand; font-size:12px' width='143' background='../images/left-bg.jpg' bgcolor='#3E70A6' height='30'> " // + "<font color='#000000'> <img src='../images/sub1_001.gif' border='0' width='16' height='16'> <font onclick=\"parent.mainFrame.location.replace('/ccmbam/syncfile/uploadsyncfile.jsp');\">文件同步管理器</font>"; // //// accout = accout + "<tr><td align='left' style=' cursor:hand; font-size:12px' width='143' background='../images/left-bg.jpg' bgcolor='#3E70A6' height='30'> <img src='../images/sub2.gif' border='0'><a href='#g' " + //// "onclick='parent.mainFrame.location.replace(this.href);' style='text-decoration: none; font-size: 12px'> " //// + "上传文件</a><br> "; // } accout += stop; request.getSession().setAttribute("roleleft", accout); } catch (Exception ex) { log.error("LoginError"); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage( "future.system.loginnorole")); request.setAttribute("logerror", "loginpage"); } if (!errors.isEmpty()) { saveErrors(request, errors); forward = new ActionForward(mapping.getInput()); } else { forward = new ActionForward(mapping.findForward("AccountLogin") .getPath()); } return forward; } @SuppressWarnings("unchecked") private String getAccount(List list) { String accout = ""; List list0 = new ArrayList(); for (int i = 0; i < list.size(); i++) { if ("0".equals(((Fucdefine) list.get(i)).getPaterId())) list0.add(list.get(i)); } if (list0.size() != 0) { for (int i = 0; i < list0.size(); i++) { int t = i + 1; String id = ((Fucdefine) list0.get(i)).getId().toString(); String defname = ((Fucdefine) list0.get(i)).getDefName(); accout += "<tr><td align='left' onclick='menuclick(submenu" + id + ");' style=' cursor:hand; font-size:12px' width='143' onmouseover='this.style.backgroundColor=#FFCCCC' onMouseOut='this.style.backgroundColor=' background='../images/left-bg.jpg' title='"+defname+"' bgcolor='#3E70A6' height='30'> " + "<font color='#000000'> <img src='../images/sub1_00" + t + ".gif' border='0' width='16' height='16'> " + defname + "</font></td>" + "</tr><tr><td align='left' width='143' style='font-size: 12px;' bgcolor='#e5ecfb'><span id='submenu" + id + "' style='margin-left:5;display:none;'>"; for (int j = 0; j < list.size(); j++) { Fucdefine fudefine = (Fucdefine) list.get(j); if (id.equals(fudefine.getPaterId())) { accout += "<img src='../images/sub2.gif' border='0'><a href='../../" + fudefine.getDefSpc() + "' style='text-decoration: none; font-size: 12px'> " + fudefine.getDefName() + "</a><br> "; } } } } return accout; } /** * 根据用户权限判断是否管理员 * @param list * @return */ @SuppressWarnings("unchecked") private boolean ifAdmin(List list){ Long id; boolean is = false; for(int i = 0; i < list.size(); i++){ id = (Long)list.get(i); if(id.equals(1)){ is = true; }else{ break; } } return is; } } |