public class Clothes extends BaseClothes<Clothes> {
public static final Clothes me = new Clothes().dao();
public Page<Clothes> paginate(int pageNumber, int pageSize) {
return paginate(pageNumber, pageSize, "select *", "from clothes order by id asc");
}
}
<---------------------------------->
protected void handleError(Controller controller) {
controller.keepModel(Clothes.class);
String actionKey = getActionKey();
if (actionKey.equals("/clothes/save"))
controller.render("add.html");
else if (actionKey.equals("/clothes/update"))
controller.render("edit.html");
}
<------------add.html--------->
#@layout()
#define main()
<h1>clothes管理 ---> 新增产品
</h1>
<div class="form_box">
<form action="/clothes/save" method="post">
#include("_form.html")
</form>
</div>
#end
<----------------_form.html-------------->
<fieldset class="solid">
<legend>新增产品</legend>
<input type="hidden" name="clothes.id" value="#(clothes.id??)" />
<div>
<label>产品编号</label>
<input type="text" name="clothes.clothesNum" value="#(clothes.clothesNum??)" />#(clothesNumMsg)
</div>
<div>
<label>零售价</label>
<input type="text" name="clothes.retailPrise" value="#(clothes.retailPrise??)" />#(retailPriseMsg)
</div>
<div>
<label> </label>
<input value="提交" type="submit">
</div>
</fieldset>
<-----------------ClothesController----------------->
public class ClothesController extends Controller {
public void index() {
setAttr("clothesPage", Clothes.me.paginate(getParaToInt(0, 1), 10));
render("clothes.html");
}
//保存
@Before(ClothesValidator.class)
public void save() {
getModel(Clothes.class).save();
redirect("/clothes");
}
}
<------------------------------>
点击提交按钮("submit")后,数据没有插入到数据库,页面也没有自动跳转,请问submit后是哪里出了问题?
项目:JFinal