Closed tian1iang closed 7 years ago
没有id属性?
有的,所有属性都会找不到,但是查出来的对象是正常的
整个edit.html 贴一下看看
<%
layout("/layouts/platform.html"){
%>
<header class="header navbar bg-white shadow">
<div class="btn-group tool-button">
<a class="btn btn-primary navbar-btn" href="${base}/platform/cms/test" id="goBack" data-pjax><i class="ti-angle-left"></i>${msg['globals.button.back']}</a>
</div>
</header>
<div class="content-wrap">
<div class="wrapper" style="min-height:500px;">
<section class="panel panel-form">
<form id="editForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
action="${base}/platform/cms/test/editDo" method="post">
<input name="id" type="hidden" value="${obj.id}">
<div class="row mb10">
<div class="col-lg-12">
<div class="form-group">
<label for="number" class="col-sm-2 control-label">${msg['cms.test.column.number']}</label>
<div class="col-sm-8">
<input type="text" id="number" class="form-control" name="number" data-parsley-required="true"
placeholder="${msg['cms.test.column.number']}" value="${obj.number}" >
</div>
</div>
<div class="form-group">
<label for="numberType" class="col-sm-2 control-label">${msg['cms.test.column.numberType']}</label>
<div class="col-sm-8">
<input type="text" id="numberType" class="form-control" name="numberType" data-parsley-required="true"
placeholder="${msg['cms.test.column.numberType']}" value="${obj.numberType}" >
</div>
</div>
<div class="form-group">
<label for="city" class="col-sm-2 control-label">${msg['cms.test.column.city']}</label>
<div class="col-sm-8">
<input type="text" id="city" class="form-control" name="city" data-parsley-required="true"
placeholder="${msg['cms.test.column.city']}" value="${obj.city}" >
</div>
</div>
<div class="form-group">
<label for="district" class="col-sm-2 control-label">${msg['cms.test.column.district']}</label>
<div class="col-sm-8">
<input type="text" id="district" class="form-control" name="district" data-parsley-required="true"
placeholder="${msg['cms.test.column.district']}" value="${obj.district}" >
</div>
</div>
<div class="form-group">
<label for="state" class="col-sm-2 control-label">${msg['cms.test.column.state']}</label>
<div class="col-sm-8">
<input type="text" id="state" class="form-control" name="state" data-parsley-required="true"
placeholder="${msg['cms.test.column.state']}" value="${obj.state}" >
</div>
</div>
<div class="form-group">
<label for="minimum" class="col-sm-2 control-label">${msg['cms.test.column.minimum']}</label>
<div class="col-sm-8">
<input type="text" id="minimum" class="form-control" name="minimum" data-parsley-required="true"
placeholder="${msg['cms.test.column.minimum']}" value="${obj.minimum}" >
</div>
</div>
</div>
</div>
<div class="col-lg-3"></div>
<div class="col-lg-6">
<div class="form-group text-center">
<label></label>
<div>
<button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="${msg['globals.button.submit.tip']}">${msg['globals.button.submit']}</button>
</div>
</div>
</div>
</form>
</section>
</div>
</div>
<script language="JavaScript">
$(document).ready(function () {
$('#editForm').ajaxForm({
dataType: 'json',
beforeSubmit: function (arr, form, options) {
form.find("button:submit").button("loading");
},
success: function (data, statusText, xhr, form) {
if (data.code == 0) {
Toast.success(data.msg);
setTimeout(function () {
$("#goBack").trigger("click");
}, 1000);
} else {
Toast.error(data.msg);
}
form.find("button:submit").button("reset");
}
});
});
</script>
<%}%>
这一行报错??
<input name="id" type="hidden" value="${obj.id}">
嗯
edit这个入口方法也贴一下
@at("/edit/?") @ok("beetl:/platform/cms/test/edit.html") @requirespermissions("platform.cms.test") public void edit(String id,HttpServletRequest req) { req.setAttribute("obj", cmsTestService.fetch(id));
完整代码
原因是啥?
@At("/edit/?") @Ok("beetl:/platform/cms/test/edit.html") @RequiresPermissions("platform.cms.test") public void edit(String id,HttpServletRequest req) { req.setAttribute("obj", cmsTestService.fetch(id)); 这是自动生成的 报未找到属性(ATTRIBUTE_NOT_FOUND):id 位于15行 资源:/platform/cms/number/edit.html这个错,其他增删查没错,我没发现代码有问题