为了账号安全,请及时绑定邮箱和手机立即绑定

订单的增加代码还有别的方法吗?

订单的增加代码还有别的方法吗?

若是你能遇见她 2018-05-04 14:42:47
<script type="text/javascript">$(function(){$("#save").click(function(){var flag=$("#standardForm").form('validate');if(flag){var formData=$("#standardForm").serializeJSON()$.post("../../stanstandardAction_save.action",formData,function(data){if(data.success){$("#standardWindow").window('close');          $("#grid").datagrid('reload'); }$.messager.alert("提示",data.message);},"json");}});});</script>action层:package com.itheima.bos.action;import org.apache.struts2.convention.annotation.Action;import org.apache.struts2.convention.annotation.Namespace;import org.apache.struts2.convention.annotation.ParentPackage;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.annotation.Scope;import org.springframework.stereotype.Controller;import com.itheima.bos.service.StandardService;import com.itheima.domain.bos.Standard;@Controller("standardAction")@ParentPackage("struts-default")@Namespace("/")@Scope("prototype")public class StandardAction extends BaseAction<Standard>{@Autowiredprivate StandardService standardService;@Action("stanstandardAction_save")public void save(){try {standardService.save(model);ajaxReturn(true, "操作成功");} catch (Exception e) {ajaxReturn(false, "操作失败");e.printStackTrace();}}service层:package com.itheima.bos.service.impl;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service;import org.springframework.transaction.annotation.Transactional;import com.itheima.bos.dao.StandardDao;import com.itheima.bos.service.StandardService;import com.itheima.domain.bos.Standard;@Service@Transactionalpublic class StandardServiceImpl implements StandardService{@Autowiredprivate StandardDao standardDao;@Overridepublic void save(Standard model) {standardDao.save(model);}dao层:package com.itheima.bos.dao;import org.springframework.data.jpa.repository.JpaRepository;import org.springframework.data.jpa.repository.Modifying;import org.springframework.data.jpa.repository.Query;import com.itheima.domain.bos.Standard;public interface StandardDao extends JpaRepository<Standard, Integer>{}
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 865 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信