江雨行的博客
江雨行 · 共 28 篇文章
Hibernate 注解整理
package com.yuxinglab.admin.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @Entity public class RolePermisson { @Id @GeneratedValue private int id; @ManyToOne @Joi…
2014-09-11 17:02 · 评论(1)
JS操作表格
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>动态表格</title> </head> <body> <p>动态表格彻底研究</p> <p>对…
2014-09-10 14:36 · 评论(0)
一个Form多个Action处理办法
< form name = "demo" method = "post" > < input type = "button" value = "添加" onclick = "addAction()" > < input type = "button" value = "删除" onclick = "deleteAction()" > < input type = "button" value = "保存" onclick = "saveAction()" > < input type = "button" value = "查询" onclick = "searchAction()" > <…
2014-08-18 08:04 · 评论(0)
使SpringMVC2.5.X支持JSON
@RequestMapping("/page/checkUserExistence.do") public void checkUserEmailExistence(String strAdminAccounts, HttpServletResponse response) { response.setContentType("text/javascript;charset=UTF-8"); response.setHeader("Cache-Control", "no-store, max-age=0, no-cache, must-revalidate"); response.addHe…
2014-08-01 10:35 · 评论(0)
mysql查询结果导出Excel
SELECT strPersonalName ,strpersonalMobilePHone FROM personalmessage p where intMessageStatus=1 or intmessageStatus=0 into outfile 'd:/filename.xls'; 关键代码: into outfile 'd:/filename.xls'
2014-07-31 16:26 · 评论(0)
SpringMVC+Spring+Hiberante整合JBPM
首先导入相关jar包, 将jpbm.cfg.xml修改后添加到classpath下: <?xml version="1.0" encoding="UTF-8"?> <jbpm-configuration> <import resource="jbpm.default.cfg.xml" /> <import resource="jbpm.businesscalendar.cfg.xml" /> <!-- <import resource="jbpm.tx.hibernate.cfg.xml" /> --> <!-- 与Spring整合需要导入jbpm.tx.spring.cfg.xml文件 -…
2014-07-29 17:16 · 评论(0)
权限控制---Filter实现
前提: 基于用户角色权限的模式。 思路: 在Filter中获取WebApplicationContext 从WebApplication中获取权限相关的Service 在Filter的doFilter方法中获取到请求路径, 如果!all.contains(has)则抛出异常。 如果请求路径不在处理范围则chain.doFilter 代码后期跟进
2014-07-29 14:16 · 评论(0)
JQ validation使用
<script src="resources/js/jquery.min.js" type="text/javascript" language="javascript"></script> <script src="resources/js/jquery.metadata.js" type="text/javascript" language="javascript"></script> <script src="resources/js/jquery.validate.min.js" type="text/javascript" language="javascript"></scrip…
2014-07-29 10:54 · 评论(0)
不使用Spring标签库,不使用js,实现Checkboxes的效果
效果如下: 实现方式: 在权限对象中加入一个标识属性,例如: @Transient private Integer isCheck; // 是否选中,就为了不用Spring标签,我容易么. 0为未选中 public AdminPermission() { isCheck = 0; } 通过构造函数,为其设置默认值。 在相关的Service中,用全部权限和角色拥有的权限作对比,如下: public List<AdminPermission> findAdminHasPermissonsByRoleId(String strId) { AdminRole adminRole = findAdmi…
2014-07-24 09:55 · 评论(0)
JS打印,根据页面内容高度,自动插入分页符
<div style="height:980px; width:0 auto;page-break-after: always;"> </div>
2014-07-18 15:04 · 评论(0)
SpringMVC中文参数乱码处理类
package com.yuxinglab.utils; import java.io.UnsupportedEncodingException; public class EncodingTool { public static String encodeStr(String str) { try { return new String(str.getBytes("ISO-8859-1"), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } } }
2014-07-17 11:05 · 评论(0)
邮件发送封装类
package com.yuxinglab.utils; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Messag…
2014-07-17 09:48 · 评论(0)
获取web应用根目录
public static String getWebRootAbsolutePath() { String path = null; String folderPath = Path.class.getProtectionDomain().getCodeSource() .getLocation().getPath(); if (folderPath.indexOf("WEB-INF") > 0) { path = folderPath.substring(0, folderPath .indexOf("WEB-INF/classes")); } return path; }
2014-07-16 11:55 · 评论(0)
导出Excel封装类(POI实现)
package com.yuxinglab.poi.test; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.ss.usermodel.Cell; import org…
2014-07-08 15:14 · 评论(0)
小知识
1.处理返回值为List的方法 @Override public List<T> getByIds(Long[] ids) { if (ids == null || ids.length == 0) { return java.util.Collections.EMPTY_LIST; } getSession().createQuery( "from " + clazz.getSimpleName() + " where id in(:ids)") .setParameterList("ids", ids); return null; } 因为专业,所以这么做。 2.POI中通用数据格式处理…
2014-07-03 17:24 · 评论(0)