========action后台我这里使用的是SpringMVC如果用ssh用法一致===============
@Controller
@RequestMapping("PubjobController")
public class PubjobController {
@Autowired
public PubjobServices pubjobServices;//业务层使用注解的方式
//Pubjob 实体
@RequestMapping("jobMgs")
public String jobMgs(Pubjob job,HttpServletRequest request, HttpServletResponse response)
throws IOException {
System.out.print(job.getId());
System.out.print(job.getName());
response.getWriter().write("操作成功!");
response.getWriter().close();
return null;
}
===========js==============
$.ajax({
type : "POST",
url : '/jubcrm/PubjobController/jobMgs.hml',
data : $("#frmjob").serialize(),//序列化表单提交input 值
success : function(msg) {
alert(msg);
}
},
error : function(msg) {
$.messager.alert(prompts(), "操作失败");
}
});
==========jsp(input 的name必须和实体名称一致)==================
<form method="post" id="frmjob" name="frmjob" action="">
名称:<input type="text" name="name" />
id:<input name="id" type="text" />
</form>