赞
踩
- <script type="text/javascript">
- function b1() {
- $("#p").focus();
- $('#p').css('ime-mode', 'disabled');
- //document.onfocus = function(){document.body.style.imeMode = 'inactive'};
- return false;
- }
- function SubmitKeyClick(obj, evt) {
- evt = (evt) ? evt : ((window.event) ? window.event : "")
- keyCode = evt.keyCode ? evt.keyCode : (evt.which ? evt.which
- : evt.charCode);
- if (keyCode == 13) {
- document.getElementById("numform").submit();
- }
- }
- </script>
- </head>
- <body>
- <form action="${pageContext.request.contextPath}/num/add.do"
- method="post" id="numform">
- <input type="text" id="p" name="content"
- οnkeydοwn="return SubmitKeyClick(this,event)" /> <input
- type="submit" οnclick="return b1()" value="开始录入" />
- </form>
- </body>
- @Controller
- @RequestMapping("/num")
- public class NumController {
-
- @Autowired
- private NumService numService;
-
- @RequestMapping("/add")
- public String add(Num num,HttpServletResponse response) throws Exception{
- int result= numService.addNum(num);
- return "page/2wm";
- }
- <mapper namespace="com.spfx.dao.NumDao">
- <resultMap type="Num" id="NumResult">
- <id property="id" column="id"/>
- <result property="content" column="content" />
- </resultMap>
-
- <insert id="addNum" parameterType="com.spfx.entity.Num">
- insert into smq
- values(null,#{content})
- </insert>
-
- </mapper>
mapper里的id对应DAO层的函数名而不是controller的。。。。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。