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"?οnsubmit="return check()">
?function check(){
if(1 != 2){
return false;
}
}
13、
點擊右鍵編輯startup.bat和shutdown.bat,在最開始的地方添加下面兩行:
SET JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_45(jdk目錄)
SET TOMCAT_HOME=D:\apache-tomcat-8.0.24(tomcat目錄)