java日常工作错误总结

1.将一个新的项目拷贝到另一台电脑上,放入tomcat中运行找不到路径,报错404、重新创建一个servlet运行就可以正常访问到。

2.但上传的文件过大时上传文件会报404错误 把<property name="maxUploadSize" value="50000000"/> 限制该大些就能正常上传文件

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> 
<property name="defaultEncoding" value="UTF-8"/> 
<!-- 指定所上传文件的总大小不能超过200KB。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 --> 
<property name="maxUploadSize" value="50000000"/>
<!-- 最大内存大小 (10240)--> 
<property name="maxInMemorySize" value="40960" />
</bean>

3.//将获取的from表单中的数据组装成 json格式

var data = $('#usingProdctMsgform').serializeArray();
//alert(JSON.stringify(data));
var json={};
for(var i=0;i<data.length;i++){
json[data[i]['name']]=data[i]['value'];
}
//alert(JSON.stringify(json));

4.jsp中移出某个div或者标签

$('body>.easyui-fluid').remove();

$('.easyui-fluid').remove();

清空提个table中的数据 $('#addusingprodcetheal').datagrid('loadData', {total: 0, rows: []});

5.树状结构多线框=====

<td>
<select id="relevant_information" name="relevant_information" class="easyui-combotree">
</select>
</td>

$('#relevant_information').combotree({
valueField: "id", //Value字段
textField: "text", //Text字段
multiple: true,
data: [{"id": '01', "text": "吸烟史"}, {
"id": '02',
"text": "饮酒史"
}, {"id": '03', "text": "妊娠期"}, {
"id": '04',
"text": "肝病史"
}, {"id": '05', "text": "肾病史"}, {
"id": '06',
"text": "过敏史"
}, {"id": '07', "text": "其他"}],
// url: "tree_data2.json", //数据源
onCheck: function (node, checked) {

if(node.id=='06' && checked){
$('#allergen').validatebox({
required: true
});
$("#allergen").removeAttr("readonly");

}
if(node.id=='06' && !checked){
document.getElementById("allergen").setAttribute("readonly",true);
$('#allergen').validatebox({
required: false
});
}

//让全选不显示
/* $("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", "")); */
},
onClick: function (node, checked) {
//让全选不显示
/* $("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", "")); */
}
});

 

6.模糊查询 筛选 

/修改模糊查询 req_desc like '%%${qry_req_desc}%%'
and (bus_no like '%%${ctt_no}%%' or bus_nm like '%%${ctt_no}%%')//同一个字段多个字段筛选
and (bus_nm like '%%${ctt_nm}%%' or #{ctt_nm} = '')
and (#{bus_select}='' OR bus_select=#{bus_select})
and (#{beg_date} ='' or tr_date >=#{beg_date}) and (#{end_date} ='' or #{end_date} >=tr_date)
order by tm_smp desc

//下拉框设置默认选中项
$("#sel").val(Array('1','2'));//设置value=1和2的选项为默认选中
//移出div=====
$('.easyui-fluid').remove();

//easy-UI通过combotree实现下拉框多选==================
//月份下拉框
$('#ddlLine').combotree({
valueField: "id", //Value字段
textField: "text", //Text字段
multiple: true,
url:"/static/a.json",
onCheck: function (node, checked) {
//让全选不显示
$("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", ""));
},
onClick: function (node, checked) {
//让全选不显示
$("#ddlLine").combotree("setText", $("#ddlLine").combobox("getText").toString().replace("全选,", ""));
}
});
json值
[{ "text": "All", "children": [{ "text": "1" }, { "text": "2" }, {"text": "3"},{"text": "4"},{"text": "5"},{"text": "6"},{"text": "7"},{"text": "8"},{"text": "9"},{"text": "10"},{"text": "11"},{"text": "12"}]}]


//============================开始时间到期时间
function calDeadline(){
var timestemp = parseInt($("#pay_period option:selected").text().split("年")[0]);
if($('#pay_time').datebox('getValue')==""||$('#pay_time').datebox('getValue')==null){return;}
var arr = $('#pay_time').datebox('getValue').split("-");
var year = parseInt(arr[0]);
var month = parseInt(arr[1]);
var day = parseInt(arr[2]);
$('#due_date').datebox('setValue',year+timestemp+'-'+month+'-'+(day-1));
}
//交费时间
$('#pay_time').datebox({
required:false,
editable:false,
onSelect: function(date){
var timestemp = parseInt($("#pay_period option:selected").text().split("年")[0]);
$('#due_date').datebox('setValue',date.getFullYear()+timestemp+'-'+(date.getMonth()+1)+'-'+(date.getDate()-1));
}
});
$('#pay_time').datebox('textbox').attr('placeholder', '请选择交费时间');
$('#pay_time').datebox('calendar').calendar({
validator:function(date){
var now = new Date();
var d1 = new Date(now.getFullYear()+'-'+(now.getMonth()+1)+'-'+now.getDate());
return date <= d1;
}
});

//打开弹框钱先查询这条数据是否有效==========================object转成string string转换成json

var htmlobj=$.ajax({url:"<%=basePath%>xyData/badSurvey/findSurveyTrigger.do?sur_id="+row.sur_id,async:false});
//object 转string htmlobj.responseText
//string转json
var str=JSON.parse(htmlobj.responseText)
//alert(str.row.flag)
//$("#myDiv").html(htmlobj.responseText);
if(1!=str.row.flag){
$.messager.show({
title: '提示',
msg: '数据为无效状态,无法进行不良调查!',
showType: 'show'
});
return;
}

posted @ 2019-12-12 10:34  红尘沙漏  阅读(183)  评论(0编辑  收藏  举报