String shopname = aykjShopForm.getShopname();
if(!shopname.matches(".+[\\u4E00-\\u9FA5]+.+")){
shopname = new String(aykjShopForm.getShopname().getBytes("ISO8859_1"),"GB2312");
}
传过来的参数如果为乱码,就不能匹配上面那个正则表示式,然后转码
public String replaceAll(String regex, String replacement)
public String replaceFirst(String regex, String replacement)
replaceAll代替所有符合正则表达式的
replaceFirst只代替第一次出现的
String path = request.getSession().getServletContext().getRealPath("/c2c/image/");
获得当前项目的绝对路径