spring项目中遇到的问题
2014-09-23 14:25
148 查看
获取span中value参数的值
输入为大于0的数的正则表达式
jsp中进行调试 debugger;
mysql主键自动增加
日期字符串在jsp中进行比较
ajax应用
jsp中的js
$(this).find('.glyphicon').attr('value')
输入为大于0的数的正则表达式
var re=/^(0\.[0-9]\d*|[1-9]\d*(\.\d+)?)$/; if (!re.test($("input[name='currencyRate']").val().trim())) { $.growlUI('提示', '输入格式不对'); return false; }
jsp中进行调试 debugger;
mysql主键自动增加
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.pandaw.model.CouponItem"> <!-- WARNING - @mbggenerated This element is automatically generated by MyBatis Generator, do not modify. This element was generated on Mon Sep 22 12:02:47 CST 2014. --> insert into coupon_item (id, title, value, type, rule, start_time, end_time) values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{value,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{rule,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}) </insert>
日期字符串在jsp中进行比较
<td> <c:set var="nowDate" value="<%=System.currentTimeMillis()%>"></c:set> <c:if test="${nowDate -couponItem.endTime.time < 0 && nowDate -couponItem.startTime.time>0 }"> 进行中 </c:if> <c:if test="${nowDate- couponItem.endTime.time > 0}"> 已结束 </c:if> <c:if test="${nowDate-couponItem.startTime.time < 0}"> 未开始 </c:if> </td>
ajax应用
jsp中的js
$.ajax({ type:'post', url:'${contextPath}/wx/order/verifyScores', data:{ scoresNum:scoresText }, success:function(data){ if(data.status == 1){ $('#addtoScores').modal('hide'); $('#scoresPrice').text(data.data); $('#defineFont1').text(data.data); var p = $('#realPriceHidden').val()*100 - $('#defineFont').text()*100 - $('#defineFont1').text()*100; p/=100; if(p < 0){ p = 0; } $('#realPriceFont').text(p); //$('#defineScores').modal(); }else if(data.status == 2){ $('#addtoScores').modal('hide'); alert('积分不足'); }else if(data.status == 3){ alert('该优惠卷未开始'); }else if(data.status == 4){ alert('该优惠卷已过期'); }else if(data.status == 5){ alert('该优惠卷已使用'); } }, error:function(){ alert('网络连接超时1'); } }); });java控制代码
@SuppressWarnings("unchecked") @RequestMapping(value = "/verifyScores") @ResponseBody public Map<String,Object> verifyScores(@RequestParam String scoresNum,@OpenId String openId) throws Exception{ Map<String, Object> res = new HashMap<String, Object>(); res.put("status", 1); res.put("data", WxUtil.scoreToMoney(Integer.parseInt(scoresNum))); User2 user = new User2(); user=user2Service.selectByOpenId(openId); if(Integer.parseInt(scoresNum)>user.getScore()){ res.put("status", 2);//积分不足 } return res; }
相关文章推荐
- spring mvc +mybatis+spring +shrio 项目开发遇到的问题及解决方案。
- SpringMVC项目接入Springfox实战遇到的问题集合
- springboot项目打成war包部署到tomcat遇到的一些问题
- 项目增加spring-session模块所遇到的问题
- maven +SpringMVC项目的创建中遇到的问题总结
- Mybatis与spring项目中遇到的奇怪的问题:Loaded JDBC driver: com.mysql.jdbc.Driver
- IDEA上面搭建一个SpringBoot的web-mvc项目遇到的问题
- spring boot 项目增加flyway的使用遇到问题解决
- 关于用-jar运行springboot项目遇到的两个问题
- springboot项目配置多环境打包部署遇到的问题总结
- 配置spring 项目时遇到的问题
- Spring 事务在实际项目中遇到的问题
- Mybatis与spring项目中遇到的奇怪的问题:ClassNotFoundException: com.mysql.jdbc.Driver
- 遇到问题---maven---启动项目出现出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoa
- Spring4MVCHibernate4重构项目遇到的问题及解决方案
- 搭建springMVC+Mybatis的Maven项目过程中遇到的问题汇总。
- Spring项目集成Spring-Session以及可能遇到的问题
- springboot中整合activiti流程设计器时遇到访问项目需要输入tomcat用户名和密码的问题
- springmvc+mybatis+maven项目集成的时候遇到一个问题,项目搭起来以后,http请求怎么都进不到controller中,页面直接返回404错误,控制台没有报任何错误,请大神帮我看看
- spring Boot项目遇到的一个小问题学习到repeatable annotations