1、获取真实路径
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
2、str.trim() //转化空字符串为HTML格式的空---> " "
3、<td nowrap="nowrap"> 里边的内容不换行
4、HTML <base> 标签 为页面上的所有链接规定默认地址或默认目标。
5、错误:error: Invalid <url-pattern> zysjgl/CwsjhzjlCreateServlet in servlet mapping
解决:在<url-pattern>加/
即: <url-pattern>/zysjgl/CwsjhzjlCreateServlet
6、验证金额
<input type="text" id="zczezy" name="zczezy" class="input"
maxlength="64" onkeyup="onlyNumber(this)" placeholder="0.00" />
function onlyNumber(obj){
//得到第一个字符是否为负号
var t = obj.value.charAt(0);
//先把非数字的都替换掉,除了数字和.和-号
obj.value = obj.value.replace(/[^\d\.\-]/g,'');
//前两位不能是0加数字
obj.value = obj.value.replace(/^0\d[0-9]*/g,'');
//必须保证第一个为数字而不是.
obj.value = obj.value.replace(/^\./g,'');
//保证只有出现一个.而没有多个.
obj.value = obj.value.replace(/\.{2,}/g,'.');
//保证.只出现一次,而不能出现两次以上
obj.value = obj.value.replace('.','$#$').replace(/\./g,'').replace('$#$','.');
//如果第一位是负号,则允许添加
obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
if(t == '-'){
return;
}
}
7、$(this).val().replace(/(^\s*)|(\s*$)/g,"");} //去掉前后空格
8、截取.之前的字符,不判断回报异常
String b="233.000";
if(b.indexOf(".")!=-1){
String d = b.substring(0, b.lastIndexOf("."));
}
System.out.println(d);
9、子弹窗跳转到父页面,刷新父页面
//js中跳转
window.location = url //本页跳转(有后退)
window.location.replace(url) //本页跳转(无后退)
window.open(url) //新窗口打开页面
parent.location.reload() //父页面重新刷新
top.location.reload() //最外层页面刷新
//html中跳转(标签内)
window.location.href = url //本页跳转
location.href = url //本页跳转
parent.location.href //上一层页面(父页面)跳转
top.location.href //最外层页面跳转