1.
String certificate="";
for(Certificate c:obj.getCertificate()){
certificate += c.getCertificate()+"<br/>";
}
这是循环一个对象集合:通过循环对象集合就可以获取到对象中的属性值
2.
<table id="dg" class="easyui-datagrid" style="height:400px"
url="employeeFileManager!list.action" idfield="userName"
toolbar="#toolbar" pagination="true" pageList="[10,20,50]",
rownumbers="true" fitColumns="false" >
<thead data-options="frozen:true">
<tr>
<th field="ck" checkbox="true"></th>
<th field="name" align="center" >姓名</th>
<th id="staffId" field="staffId" align="center" width="100" align="center" hidden="true">员工编号</th>
<th id="age" value="age" field="age" align="center" width="200" align="center" hidden="true">年龄</th>
<th id="certificate" value="certificate" field="certificate" width="100" align="center" align="center" hidden="true">证书</th>
<th id="companyLevel" value="companyLevel" field="companyLevel" align="center" hidden="true">公司岗层级别</th>
</tr>
</thead>
</table>
var fieldTemp;//设置为全局变量
function showMsg(){
var dg = $("#dg");
var checkValue=$("#query_conditions").val();
// fieldTemp = checkValue;
if(fieldTemp){
$("#dg").datagrid('hideColumn', fieldTemp);
}
fieldTemp = checkValue;
var colWidth = $("#"+checkValue).attr("width");
$("#dg").datagrid('showColumn', checkValue);
$("#dg").datagrid('autoSizeColumn', checkValue);
}
3.
程序中有关数据库字段的取值和塞值都应该是根据实体类中的字段名来进行操作而不再是根据数据库里的字段名称。
4.
// ProductInfo productInfo = new ProductInfo();
for(int i=0;i<listProduct.size();i++){
ProductInfo productInfo = new ProductInfo();
long imagesId = listProduct.get(i).getImagesId();
List<ImagesList> listImages = imagesListManager.getById(imagesId);
productInfo.setProductsName(listProduct.get(i).getProductsName());
productInfo.setProductsId(listProduct.get(i).getProductsId());
productInfo.setFilePath(listImages.get(0).getFilePath());
listProductInfo.add(productInfo);
}
在for循环里new ProductInfo对象和在for循环外new ProductInfo对象效果是不一样的!
在for循环里new ProductInfo对象循环长度有多长就会new出多少个ProductInfo对象,而在for循环外new ProductInfo对象的话则不论循环长度有多长都只会new出一个ProductInfo对象!
5.
<script>
function aaa(){
var uuid =${miniUuid};
if($("#indent").val()==""){
alert("请输入您所要查询的证件号码");
}else{
var indent = $("#indent").val();
$.ajax({
url:'<%=path%>/product/queryOrder',
(url:'<%=path%>/product/queryOrder?indent='+indent+'&miniUuid='+uuid,)//ajax尽量少用这种方法传参应该使用下面红字渲染的方法来将参数传给后台
type:'post', //数据发送方式
dataType:'json', //接受数据格式
data:{indent:indent,miniUuid:uuid},
success:function(data){
if(data.result==""){
alert("没有查询结果");
}else {
$("tr").remove();
json = eval(data.result);
var item="";
for(var i=0;i<json.length;i++){
item="<tr><td>"+json[i].orderno+"</td><td>"+json[i].customerName+"</td><td>"+
json[i].credentialsNum+"</td><td>"+json[i].contactMobile+"</td><td>"+json[i].installedAddress
+"</td><td>"+json[i].orderStatus+"</td></tr>";
$("#tr").append(item);
}
};
}
});
}
}
</script>
@RequestMapping(value = "/product/queryOrder")
@ResponseBody
public Map<String,String> queryOrder(HttpServletRequest request ,String indent,String miniUuid)//用ajax data{}传参的方法就能这样接收传递过来的参数{
Map<String ,String> map = new HashMap<String, String>();
(String indent = request.getParameter("indent");)//此种方法是用来接收前面不推荐的ajax传参方法传递过来的参数的
Order order = new Order();
order.setCredentialsNum(indent);
order.setMiniUuid("26");
List<Order> list = goodsInfoManager.queryOrder(order);
if(list.isEmpty()){
map.put("result", "");
}else{
net.sf.json.JSONArray obj = net.sf.json.JSONArray.fromObject(list);
String json = obj.toString();
map.put("result", json);
}
return map;
}
6.
关于table标签的问题
table标签下是不能直接添加东西的,东西必须添加在table标签下的<tr><td></td></tr>中