http://www.jb51.net/article/16645.htm [crayon-6abe8a519…
不静之心
分类:专业技术
如何在地址栏中显示网站的图标
http://hi.baidu.com/langyanqi/blog/item/3316544e9bdb640…
十五种CSS鼠标样式
http://linder0209.iteye.com/blog/875203 CSS鼠标样式语法如下: 任意…
ps切图转网页代码(psd to html)
转自:http://shansun123.iteye.com/blog/534161 例子: http://w…
垂直居中的两种实现方法
方法一:利用行高(line-height)定位 line-height通常是用于调节一段文字的行与行之间的距离…
让图片 div居中实现代码
http://www.huomaw.com/css/201010/8171.html [cray…
javascript 生成随机颜色
http://hi.baidu.com/lovebwf/blog/item/ddf768168f31894f2…
CSS 禁止滚动条
http://www.lunelove.com/david/Article.asp?ItemID=92 1、完…
css样式控制超链接颜色显示
http://www.wangchao.net.cn/bbsdetail_1846946.html 很多人在网…
js对表格的操作
http://dikar.iteye.com/blog/143593 [crayon-6abe8a519ba1…
JLabel文本自动换行,限定宽度获取高度
http://blog.csdn.net/polarman/article/details/4160045 U…
oracle 动态执行sql
oracle 使用DBMS_SQL包动态执行sql http://blog.csdn.net/wbj12345…
java读取图片长宽问题
参考 Java代码 http://www.java3z.com/cwbwebhome/article/arti…
hashmap,hashtabl,hashtree,linkedhashmap区别分析
java为数据结构中的映射定义了一个接口java.util.Map;它有四个实现类,分别是HashMap Ha…
方法拦截器:MethodInterceptor
注意: 下面的配置不是拦截Controller的, 拦截Controller的需要在servlet.xml, …
ThrowsAdvice和自动代理的例子
参考: http://www.blogjava.net/liuwentao253/archive/2007/0…
一个用Spring AOP实现异常处理和记录程序执行时间的实例
http://blog.csdn.net/liuzhenwen/article/details/3938883
MessageUtils:ResourceBundle访问properties文件
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
package com.app; import java.io.Serializable; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.MissingResourceException; import java.util.ResourceBundle; import org.apache.commons.lang.StringUtils; public class MessageUtils implements Serializable{ /** * @param args */ private static String locale; private static ResourceBundle bind; private static String baseName; public static String getBaseName() { return baseName; } public static void setBaseName(String baseName) { MessageUtils.baseName = baseName; bind = null; } public static String getMessage(String key){ String message = null; try { message = getBind().getString(key); } catch (MissingResourceException e) { return "@@ Not found message for key="+key; } if(StringUtils.isBlank(message)) return "@@ Not found message for key="+key; return message; } public static String getMessage(String key,Map<String,String> values){ String message = null; try { message = getBind().getString(key); } catch (MissingResourceException e) { return "@@ Not found message for key="+key; } if(StringUtils.isBlank(message)) return "@@ Not found message for key="+key; if(values==null) return message; Iterator it = values.keySet().iterator(); while(it.hasNext()){ String paraName = it.next().toString(); key.replaceAll("{"+paraName+"}", values.get(paraName).toString()); } return message; } public static String getMessage(String key,String[] values){ String message = null; try { message = getBind().getString(key); } catch (MissingResourceException e) { return "@@ Not found message for key="+key; } if(StringUtils.isBlank(message)) return "@@ Not found message for key="+key; if(values==null||values.length==0) return message; for(int i=0; i<values.length; i++){ key.replaceAll("{"+i+"}", values[i]); } return message; } public static String getMessage(String key,List<String> values){ String message = null; try { message = getBind().getString(key); } catch (MissingResourceException e) { return "@@ Not found message for key="+key; } if(StringUtils.isBlank(message)) return "@@ Not found message for key="+key; if(values==null||values.size()==0) return message; for(int i=0; i<values.size(); i++){ key.replaceAll("{"+i+"}", values.get(i)); } return message; } public String getLocale() { return locale; } public void setLocale(String locale) { this.locale = locale; } private static ResourceBundle getBind() { if(baseName==null) baseName = "locale.message"; if (bind == null) { if (locale == null || locale.equals("")) //src/locale/message.properties bind = ResourceBundle.getBundle(baseName); else bind = ResourceBundle.getBundle(baseName + locale); } return bind; } public void setBind(ResourceBundle bind) { this.bind = bind; } public void reset(){ bind = null; baseName = null; } public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(MessageUtils.getMessage("com.s2s3h3.app.testMessage",new String[]{"aaa","bbb"})); MessageUtils.setBaseName("struts"); System.out.println(MessageUtils.getMessage("struts.login.pageName")); } } |
java.util.MissingResourceException: Can’t find bundle for base name
解决办法 1: http://blog.sina.com.cn/s/blog_4bb5650c01007t2f…
jxl得到一个字符串的宽度
|
1 2 3 |
JLabel jlabel = new JLabel(test_str); FontMetrics fm = jlabel.getFontMetrics(new java.awt.Font("Times New Roman",java.awt.Font.PLAIN, 12)); System.out.println("string width="+fm.stringWidth(test_str)); |
jxl读取行高度的问题
|
1 |
sheet.getRowView(0).getDimension() |
这一段代码就是读取行高度。 我现在要放一段数…
HTML的hr变成虚线
|
1 2 |
border: none; border-top: 1px dotted #ccc; |
jQuery选择器整理
http://blog.csdn.net/paulgerchen/archive/2010/06/03/564…
预览文章: 一个Jquery的圆角插件
http://jrc.rctonline.nl/
Validation验证多次提交重复积累信息的解决办法
http://news.qiku.info/blog/3702.html 让XXXAction类实现Prepa…
整个div居中,不是div中的内容居中
首先,在jsp前面加入 Xml代码
|
1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
我半天没…
DIV高度自适应(min-height)与设置DIV最小高度为1px
http://www.syscy.com/articleview/2009-6-2/article_view_…
Display Tag Lib 显示表格标签
Display Tag Lib 显示表格标签 display:table class=”its&#…
一个免费的日志查看工具
下载: http://www.baremetalsoft.com/baretail/ 介绍: http://w…
程序即时读取日志文件
http://xieruilin.iteye.com/blog/716031 [crayon-6abe8a51…
SiteMesh学习入门
SiteMesh学习入门 http://www.java3z.com/cwbwebhome/article/a…
Spring3.0中的AOP配置方法
http://zywang.iteye.com/blog/974226 第一种 [crayon-6abe8a5…
Spring整合Hibernate 实现DAO组件
为了实现DAO组件,Spring提供了大量的XxxDaoSupport类,这些DAO支持类对于实现DAO组件有…
Log4Jdbc测试例子
Log4Jdbc测试例子 http://bbs.chinaunix.net/viewthread.php?ti…
log4j.properties模板
参数说明参阅: http://www.codeif.com/topic/291 log4j每天产生一个日志文件…
