常用java技术_java常用技术
struts2基本包commons-logging-*.jar Apache旗下commons项目的log日志包
freemarker-*.jar 一种前台页面模板,应用比较广泛
ognl-*.jar 动态图导航语言,struts2处理前台页面的核心语言,相当实用
struts2-core-*.jar struts2的核心包
xwork-core-*.jar webwork的核心包,因为struts2的前身是webwork,所以这个是必须
网页在title上面添加小logo
struts2中Action获取request、response、session
/**
* struts2中Action获取request、response、session
* 我们平常所说的session一般是HttpSession,但在struts2中被封装成了Map类型。
*/
ActionContext context = ActionContext.getContext();
HttpServletRequest request = (HttpServletRequest) context.get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse) context.get(ServletActionContext.HTTP_RESPONSE);
Map session = context.getSession();
富文本框
参考资料:http://blog.csdn.net/zou_hailin226/article/details/7564629

数据库可以用CLOB,或直接生成静态页面
WEB.XML中的配置
30
配置在项目web.xml中,在tomcat下的conf目录中的web.xml也可配置
500
/commons/error.jsp
404
/commons/404.jsp
403
/commons/403.jsp
Java生成随即数
Random random = new Random();
int nextInt = 0;
for(int i=0;i<10;i++){
nextInt = random.nextInt(100);//中如果带参,表示0至带参数中间的随即数,可以不带参
System.out.println(nextInt);
}
数据库使用IF判断
1.CASE WHEN THEN 值 ELSE 值
SELECT (CASE WHEN promotionsCommissionCoefficient = 1 THEN '是' ELSE '否' END) AS promotionsCommissionCoefficient FROM sell_serv_system
2.IFNULL(FWorkers,0)
3.FROM_UNIXTIME('YYYY-MM-DD HH:MM:SS',statisticsDate)
SELECT FROM_UNIXTIME('YYYY-MM-DD HH:MM:SS',字段名),IFNULL(字段名,0) from 表名
javascript和jQuery控制input中的checked属性
var radiovar = document.getElementsByName("a");
for(var i=0;i
{
if(radiovar[i].value==2)//这个2即为你所要找的input的值
radiovar[i].checked = "checked";
}
//或者用jquery
//$("input[type='radio'][value=2]").attr("checked","checked" );
文件转码工具
命令窗口输入
native2ascii 转码
native2ascii -reverse 解码
Java正则表达式用法
String str1 = "CN_11111111_163805_FB030020_20130002";
String str2 = "CN_11111111_163805_FB030020_20130002_12345678.jpg";
Pattern pattern = Pattern.compile(str1+"_\\d*.[j,J][p,P][g,G]");
Matcher matcher = pattern.matcher(str2);
boolean boo = matcher.matches();