/***java代码**/
@AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp","8192","UTF-8","10000"})
public Object add(@Param("..")ClothesType clothesType,int firstparent_id,@Param("Filedata")TempFile[] files,
int secondparent_id,ServletContext context,
HttpServletRequest req)
/***表单form*/
- 分类名称:不能为空
- 上传图片
/***ajax提交*/
function save(){
var AjaxURL= "${base}/clothesType/add";
$.ajax({
type: "POST",
dataType: "json",
url: AjaxURL,
data: $('#addId').serialize(),
success: function (result) {
var strresult=result.result;
if(strresult==1){
alert("新增成功");
window.location.href="${base}/clothesType/search";
}
if(strresult==3){
alert("名称已经存在 ");
}
if(strresult==4){
alert("不能保存空记录");
}
},
error: function(data) {
alert("error:"+"保存失败");
}
});
}
/***异常**/
java.lang.IllegalArgumentException: Unknow Content-Type : application/x-www-form-urlencoded