错误细分1-50条(很早很早以前踩过的坑)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_36810906/article/details/80275016

1.空指针异常

dao调用方法写错增加修改写成查询

2.程序不执行

勿用原来的类,类型和名称不一样,无法衔接

3.系统报错

字段长度错误

4.java.sql.SQLException: Invalid value for getInt() - 'Z01' in column 9

字段被修改了类型,数据库和实体类不一致

5.表不存在

表名写错了

6.更新时间,sql错误

时间写到最后,其他可以判空,可以全部更新也可以更新单独几个

7.js中function方法显示未定义

括号错误

8.consol不存在

少写了log

9.window.location="http://www.jdpc.com/pay.html?deposit='+deposit+'&bidding_number='+'bidding_number";

参数拼接

10.document.getElementById("bidding_number").innerHTML;

div中取值问题

11.document.getElementById("auctionLists").value;

获取id的值

12.window.location="http://www.jdpc.com/pay.html?pay_value='+pay_value+'&bidding_number='+'bidding_number'+'&payType='+'payType&name='+'name

拼接

13.zhifu.style.display = "block";

     baozhengjin.style.display = "none";

隐藏域问题

14. style=" margin: 15px 15px 0px 0px; padding: 0px 10px;background-color: red;color: white;  border-radius: 6px; width: 80px; text-align: center;

按钮设置

15.方法不走success

application/json     dataType  contentType

16.URLEncoder.encode(formstring)

方法不走success    decodeURIComponent(data.outputData.formstring);

17.布局问题

div,css调试

18.乱码问题

循环string,去空格

19.断点被禁用

取消

20.jar包冲突了

修正

21.数据库连接错误

修改jdbcUrl

22.dispaly

display尽量不要用block,设置为展示可以设置为""

23.<tr>
             <td></td>
             <td colspan="2" style="padding-top:10px;">
             <input id="calcelpayconfirm" type="button" class="user_button" value="放弃"  style="width:120px;margin-right:10px;background:red" />
             &nbsp;
  <input id="submitpayconfirm" type="button" class="user_button" value="提交"  style="width:120px;background:red" />
             </td>
             <td></td>
         </tr>

样式的设置和调整,内敛外联都可以调整,如果有覆盖用内连来设置

24.text-align:left;

左对齐右对齐

25.能用实体类不要用map

写sql的时候

26.数据库和实体类的定义问题,还有api的类型问题

最好统一,避免解析json出错

27.        inputData.fromJson(json);
            Map<String,Object> inmap=inputData.toMap();
            List<Bidwinorder> list = new ArrayList<Bidwinorder>();

            list = (List<Bidwinorder>) inmap.get("bidwinorderList");

map中入参是集合的解析

28.JSONObject jsonObject = JSONObject.fromObject(json);
   jsonObject.get("bidwinorderList");

   jsonObject.getJSONArray("bidwinorderList");

从json中获取map中的list,从list中获取数组

29.作为条件时,string用equeals

30.sql错误   in ()    写成了  in {}

31.limit 4,9

不是从4到9而是从4往后的9条数据

32.<div class="my" data="1">我的表情</div>.

获取“我的表情”,可以使用$("div").text()或者$("div").html();

+'<div class="l_btn" onclick="onezhifu('+bidwinorderList[i].orderState+');">';

33.//隐藏胜出拍品界面,展开支付界面(隐藏域)
 document.getElementById("bidwinorder").style.display = "none";;

 document.getElementById("payconfirm").style.display = "";

34. auction_id=$("#auctionLists").find("option:selected").val(); //获取Select选择的Value

35.ajax传的json对象

//声明对象
  var queryObj = {};
  var bidwinorderList=[];
  for( var i = 0; i < itemcodes.length; i++){
   var bidwinorder={};
   bidwinorder.itemcode=itemcodes[i];
   bidwinorder.orderID=orderIDS[i];
   console.log("获取到的对象"); 
   bidwinorderList.push(bidwinorder);
  }
  console.log("获取到的对象");console.log(bidwinorder);  console.log(bidwinorderList); 
  
  queryObj.requestFrom=1;
  queryObj.auction_id=auction_id;
  queryObj.bidwinorderList=bidwinorderList;

  console.log(queryObj);

36.mybatis中的一般使用#,但是字符串使用$.

37.redis设置定时器(密码或者频繁接口访问)

//新增逻辑,用radis来限制接口被重复访问。
    //声明一个rediskey特殊标志;
    String redisKey = "ADD_COLLECT" +user_id ;//设置用户的标志
    int count =Integer.valueOf((String) redis.getValue("redisKey"));
    //判断是否是第一次调用接口,如果是第一次调用,设置使用次数为1,调用工具类,将用户标志作为key,次数作为value存入;
    if(count==0 ){
     num=1;
     JedisUtil redis = new JedisUtil();// 获取jedis
     redis.setValue("redisKey", ""+num);
     int a =userService.AdduserCollections(uuid, logger, inputMap);
     if(a==1){
      outputData.setMsg("成功");
      }else{
      outputData.setMsg("失败");
      }
    }
    //判断redis中值存在,累加一次;获取用户访问接口的次数,判断是否大于
    if(count>0){
     num++;
     redis.setTimeValue(redisKey, 60, "21");//设置60s内收藏不能超过20次
     redis.setValue("redisKey", ""+num);
    
     
     if(count>20){
      outputData.setMsg("每分钟只能收藏20次,您收藏过于频繁,请明日再试再试");
      //获取当前的时间,设置24小时候解除限制。
      Date date = new Date();// 新建此时的的系统时间
      Date dateTomorrow=null;
      Calendar calendar = Calendar.getInstance();
       calendar.setTime(date);
       calendar.add(Calendar.DAY_OF_MONTH, +1);//+1今天的时间加一天
       dateTomorrow = calendar.getTime();//获取明天的时间
       redis.setValue("timestart", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dateTomorrow));
     }
    } 
    //作为入参调用AuctionService 的queryAuctionList ()查询拍卖会集合,接收返回值;
//解除禁用状态
    logger.info("调用auctionService的queryAuctionList查询拍卖会集合,入参是"+inputMap);
    
     //判断
    String  date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
    String timestart =(String) redis.getValue("timestart");
     if(date.equals(timestart)){
      redis.delValue("redisKey");

     }

38.年月日时分秒的转换

Date date = new Date(timestamp);

SimpleDateFormat fomat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

39.js传值---值为字符串类型加/'

onclick="addCollection(\''+categoryLists[i].categoryId+'\')"

40.nginx,tomcat测试时防止重定向,最后路径后加/

41.时间差

//获取第一个时间
    Date d1 = (Date)request.getSession().getAttribute("date1");
    //获取第二个时间
    Date d2 = (Date)request.getSession().getAttribute("date2");
    //相差的毫秒数
    long time = d1.getTime()-d2.getTime();
    //相差的秒数

    long result = time/1000;

42.样式调整

三个div或者span要保证有同样的高度。

43.template ,freakmarker 

发送邮件,模板的路径错误,配置spring jar包的导入

44.多个div,任意选中一个变色,选中另一个前一个样式取消(设置同级div的样式)

<div id="changColor" class="changColor">
 <div onclick="stateColor(3);" id="orderStateAll" name ="stateColor" style="width:90px;height:17px;cursor:pointer;margin: auto;">
        <a href="javascript:void(0)">全部拍品订单</a>
       </div>
 <div onclick="stateColor(0);" id="orderState0" name ="stateColor" style="width:50px;height:17px;cursor:pointer;margin: auto;">
        <a href="javascript:void(0)">未支付</a>
       </div>
 <div onclick="stateColor(1);"id="orderState1" name ="stateColor" style="width:50px;height:17px;cursor:pointer;margin: auto;">
        <a href="javascript:void(0)">待取货</a>
       </div>
 <div onclick="stateColor(2)"id="orderState2"  name ="stateColor" style="width:50px;height:17px;cursor:pointer;margin: auto;">
        <a href="javascript:void(0)">已完成</a>
       </div>

      </div>

45.鼠标事件可以用a标签hover样式(css)来控制

.changColor a:hover{
  background-color: red;
}
.changColors{
  background-color: red;

}

46.多个情况获取一个值,可以调用公共函数部分,传值不同

//点击事件,传递不同的值
function stateColor(states){
 console.log("方法被调用了");
 //获取值
 if(states==0){
  orderState=0;
 }else if(states==1){
  orderState=1;
 }else if(states==2){
  orderState=2;
 }else{
  orderState=null;
 }
 console.log("获取到的状态");console.log(orderState);

}

47.设置提示信息的方式

写好后设置display为none,需要显示时直接显示即可,show,hide,none,""

48.bootstrap 按钮颜色属性有几种

7种,分别是白色,浅蓝色,深蓝色,绿色,黄色,红色,黑色,对应的class为btn,btn btn-primary,btn btn-info,btn btn-success,btn btn-warning,btn btn-danger,btn btn-inverse

49.xml文件的映射

映射前不能有空格

50.xml文件的映射类型

resutlMap resutType

猜你喜欢

转载自blog.csdn.net/weixin_36810906/article/details/80275016
今日推荐