备忘(持续更新。。。)

1、在springmvc这个框架里面,创建新的业务逻辑层,dao、service层至少需要一个接口,项目才能跑起来

2、获取当前用户桌面路径

File desktopDir = FileSystemView.getFileSystemView() .getHomeDirectory();

String desktopPath = desktopDir.getAbsolutePath();

 3、项目启动不了,并且控制台停滞到如下这里,先检查xx.xml文件里面与对应的xx.dao中的方法个数是否一致,再检查方法是否拼错

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/YUNYUAN/ws5/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/phoon/WEB-INF/lib/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/YUNYUAN/ws5/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/phoon/WEB-INF/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]

 4、问题情境:公共文件a.js中的url参数为服务器的路径,可供所有需要服务器路径的js文件引用,在index.html中,引用了a.js和b.js,当b.js需要引用a.js中的url参数时,a.js在index.html中的引用位置需在b.js前面

5、出现如下问题时:

原因是:当参数放在map对象中传递到xml中时,如果需要判断某一个元素的值,只需要写该元素的名称,不用写params.元素名;如下:

    <if test="startDate != 'all' and startDate != ''">
          and lrr.operateTime <![CDATA[>=]]> #{startDate} and lrr.operateTime <![CDATA[<=]]> #{endDate}
       </if>
    
    <!--错误演示-->
    <if test="param.startDate != 'all' and param.startDate != ''">
          and lrr.operateTime <![CDATA[>=]]> #{startDate} and lrr.operateTime <![CDATA[<=]]> #{endDate}
       </if>

 6、window.location.href 不跳转

第一步查看是否是程序问题,断点看看是否进行到了这一步

第二步则分析可能是表单的问题,页面如果不用submit提交的话,把submit换成其他的,如按钮,或者去掉form标签

7、去掉UUID的小横线

Java代码:

UUID uuid  =  UUID.randomUUID();

System.out.println(uuid.toString().replaceAll("\-"""))

MySQL:

select replace(UUID(),'-','') as id;

8、order by 字符串 desc/asc 排序不准确

varchar类型的排序规则就是按从左向右比较排,重新定义数据类型如果按照字符串来排序,这个结果是正确的,如果想按照数值排序,有以下几种方法:
1.order by price+0 desc
2.order by CAST(price as SIGNED) desc
3.order by CONVERT(price,SIGNED) desc

9、jstl中c:if 判断某一list是否为空,或者说判断某一list集合的长度

<c:if test="${empty list}">  --> 表示 “如果list为空”
<c:if test="${not empty list}"> --> 表示 “如果list不为空”

<c:if test="${list == null || fn:length(list) == 0}"> --> 表示“如果list为空或者list的长度等于0” 其中fn.length(list) 可获取list的长度

10、MySQL常用函数

   1.ceil () 向上取整

  例: ceil(1.2) = 2 

   2.floor () 向下取整 

  例: floor(1.2) = 1 

   3.round() 四舍五入 

11、现用框架中没有出现数据的可能原因

  ①js文件中有报错,打开开发者工具即可看到

  ②jsp文件中引用的js路径有错

12、form表单验证,onsubmit用法

  <form action="" method="post" enctype="multipart/form-data" onsubmit="return check()">

   function check(){

    if(1 != 2){

      return false;

    }

  } 

13、

点击右键编辑startup.bat和shutdown.bat,在最开始的地方添加下面两行:

SET JAVA_HOME=C:Program Files (x86)Javajdk1.8.0_45(jdk目录)
SET TOMCAT_HOME=D:apache-tomcat-8.0.24(tomcat目录)

原文地址:https://www.cnblogs.com/Crysta1/p/7838546.html