1.${SESSION_USER_V2}
創(chuàng)新互聯(lián)主營金口河網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,重慶App定制開發(fā),金口河h5小程序開發(fā)搭建,金口河網(wǎng)站營銷推廣歡迎金口河等地區(qū)企業(yè)咨詢 會從大到小查找作用域中的attribute
PageContext PageScope
servletRequest RequestScope
httpSession SessionScope
Application/servletContext ApplicationScope
2.${param.name}
實(shí)際上是相當(dāng)于request.getParameter("name")方法
3.空連接
href="#"方法:
其實(shí)也是空連接的意思,但是點(diǎn)擊之后會自動跳轉(zhuǎn)到頁面的最上面,因?yàn)橛昧诉@個方法就相當(dāng)于點(diǎn)擊了一個錨記,但是這個錨記又沒寫ID,所以就默認(rèn)跳轉(zhuǎn)到頁面頂部。
href="javascript:void(0);"方法:
void是一個操作符,這個操作符指定要計(jì)算一個表達(dá)式但是不返回值。如果在void中寫入0(void(0)),則什么也不執(zhí)行,從而也就形成了一個空鏈接。
#與javascript:void(0)的區(qū)別:
所以,#與javascript:void(0)的區(qū)別也很明顯,#方法會跳轉(zhuǎn)到頁面的頂部,并且在頁面URL后面會出現(xiàn)#,而javascript:void(0)方法不會,所以如果是空連接的話,還是推薦javascript:void(0)。
4.添加刪除樣式
$(function(){
$("#myArticle").click(function(){
$("#allArticle").removeClass("current");
$("#myArticle").addClass("current");//最好不要用Attr()和removeAttr(),因?yàn)閏ss樣式會繼承
})
$("#allArticle").click(function(){
$("#myArticle").removeClass("current");
$("#allArticle").addClass("current");//
})
})
5.SpringMVC獲取session
直接在方法上使用 HttpSession即可注入
或者注入HttpServletRequest--->再獲取Session
6.攔截器配置
applicationContext.xml
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/comment*"/>
<mvc:mapping path="/article/add"/>
<mvc:mapping path="/article/myArticle"/>
<bean class="com.dooioo.samples.blog.inteceptor.LoginInteceptor" />
</mvc:interceptor>
</mvc:interceptors>
7. context root設(shè)置問題
比如我們的項(xiàng)目名稱是myApp(即myApp文件夾下有WEB-INFO文件夾),發(fā)布在本機(jī)80端口,且context-root設(shè)置為myApp,
則訪問默認(rèn)歡迎頁面時的url是:http://localhost:80/myApp。如果context-root設(shè)置成/,則url會變成:http://localhost:80/
1.在新建web項(xiàng)目時,仔細(xì)觀察會有輸入框提示輸入context-root,如果希望url是后者的樣子,則context-root框中只輸入"/"即可,否則輸入你想要的目錄名稱;
2.如果您使用eclipse開發(fā),則在項(xiàng)目上右擊,然后選擇屬性,再選擇Web Project Settings,然后修改
context-root內(nèi)容;若您使用myEclipse開發(fā),則右擊項(xiàng)目-->“Properties”-->“MyEclipse”-->“Web”,看到了吧“Context Root”選項(xiàng)卡里的“Web Context-root”,修改之;
8.修改eclipse虛擬機(jī)內(nèi)存
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms256m
-Xmx1024m 堆內(nèi)存
-XX:PermSize=512M 非堆內(nèi)存
-XX:MaxPermSize=1024M
9.Target runtime Apache Tomcat v6.0 is not defined.
項(xiàng)目文件夾下
.settings\org.eclipse.wst.common.project.facet.core.xml文件中
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v6.0"/>
<fixed facet="java"/>
<fixed facet="jst.web"/>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
刪除掉 <runtime name="Apache Tomcat v6.0"/>
10. Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

11. ibatis中sql語句中#與$的區(qū)別
1.#是把傳入的數(shù)據(jù)當(dāng)作字符串,如#user_id_list#傳入的是1,2,則sql語句生成是這樣,in ('1,2') ,當(dāng)然不可以
2.$傳入的數(shù)據(jù)直接生成在sql里,如#user_id_list#傳入的是1,2,則sql語句生成是這樣,in(1,2) 這就對了.
3.#方式能夠很大程度防止sql注入
4.$方式無法方式sql注入
5.$方式一般用于傳入數(shù)據(jù)庫對象,例如傳入表名
直觀的說
#str# 出來的效果是 'str'
$str$ 出來的效果是 str
另外 ##只能用在特定的幾個地方 $$可以用在任何地方 比如 order by $str$
你甚至可以直接寫 $str$ 把 order by 這個字串放在str里傳進(jìn)來
12. model.addAttribute(article)
默認(rèn)key為article的類型
13.springmvc的controller默認(rèn)是單例的
可以加上@Scope("prototype")變?yōu)槎鄬?shí)例的
14.<jsp:param>標(biāo)簽
<jsp:param>操作被用于以"名-值"對的形式為其他標(biāo)簽提供附加信息。
它可以和<jsp:include>,<jsp:forward>,<jsp:plugin>一起使用。
例1:實(shí)現(xiàn) includeaction.jsp中展示come.jsp頁面,值由主頁面?zhèn)魅搿?br />
includeaction.jsp代碼
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GB18030"> <title>Include</title> </head> <body> <%double i = Math.random();%> <jsp:include page="come.jsp">//加載come.jsp <jsp:param name="number" value="<%=i%>" />//傳遞參數(shù) </jsp:include> </body> </html>
在come.jsp代碼
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>come</title>
</head>
<body bgcolor=cyan>
<Font Size=3>
<%//獲得includeAction.jsp傳來的值:
String str = request.getParameter("number");
double n = Double.parseDouble(str);
%>
The value form includeAction is:<br> <%=n%>
</Font>
</body>
</html>15. return false
取消元素的默認(rèn)行為
16.Ibatis中SqlMapClientTemplate和SqlMapClient的區(qū)別
SqlMapClientTemplate是org.springframework.orm.ibatis下的
而SqlMapClient是ibatis的
SqlMapClientTemplate是SqlMapClient的封裝類.
SqlMapClient中包含著session的管理.
SqlMapClientTemplate用于session的封裝,以及異常的捕捉.
所以按照以上的推斷來說.應(yīng)該盡量使用SqlMapClientTemplate.
保證session以及Exception的正常以及統(tǒng)一.
參考文章:
http://blog.csdn.net/wxwzy738/article/details/16953609
17.there is no statement named xxx in this SqlMap
sqlmap文件定義了namespace屬性,就需要這樣寫:(你的namespace).(定義的statement的id),如果把namespace屬性漏了,就被報(bào)此異常
<sqlMap namespace="Category"> <typeAlias alias="category" type="com.dooioo.samples.blog.model.Category"/> <select id="query" resultClass="category"> select * from category where status != -1 </select> <insert id="insert" parameterClass="category"> insert into category(name) values (#name#) </insert> <update id="delete" parameterClass="int" > update category set status=-1 where id=#id# </update> <select id="queryForPaginate2" parameterClass="category" resultClass="category"> mst_sp_pageshowex4 '$columns$ ','$table$','$where$','$orderBy$',$pageSize$,$pageNo$ </select> <select id="count2" parameterClass="category" resultClass="integer"> sp_pagecount '$table$','$where$' </select> </sqlMap>
18. ibatis upadte delete insert 返回作用的行數(shù)
com.dooioo.web.converter.DyMappingJacksonHttpMessageConverter
19.HTTP400\HTTP500
HTTP400 錯誤的請求
HTTP500 內(nèi)部服務(wù)器錯誤!
404請求 404狀態(tài)碼是一種http狀態(tài)碼,其意思是: 所請求的頁面不存在或已被刪除!
通俗的講就是當(dāng)用戶輸入了錯誤的鏈接時,返回的頁面。
20.@ModelAttribute Article article, BindingResult result
(BindingResult result必須緊跟在@ModelAttribute后面)
21 @ModelAttribute和@Valid區(qū)別
@ModelAttribute is used to map/bind a a method parameter or method return type to a named model attribute. See @ModelAttributes JavaDoc. This is a Spring annotation.
@Valid is an annotation that marks an object for JSR-303 bean validation. See @Valids JavaDoc. It is part of JavaEE 6, but I think Hibernate has an earlier implementation that most people use instead.
The advantage of using @ModelAttribute is that you can map a form's inputs to a bean. The advantage of @Valid is that you can utilize JSR-303 bean validation to ensure that the bean that is made is validated against some set of rules.
Yes you can use @ModelAttribute and @Valid together.
JSR 303 – Bean Validation 是一個數(shù)據(jù)驗(yàn)證的規(guī)范
22.sqlserve服務(wù)器密碼登錄
http://blog.csdn.net/jufeng9318/article/details/8203780
23.EL表達(dá)式加三元表達(dá)式
<input id ="keyword" type="text" name="keyword" value="${ keyword !=null ? keyword : '輸入問題關(guān)鍵詞,如:產(chǎn)品線、技術(shù)分享等…' }" >
24. web.xml啟動順序
1.context-param
2.listener
3.filter
4.servlet
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
當(dāng)前題目:SpringMVC知識點(diǎn)匯總-創(chuàng)新互聯(lián)
文章路徑:http://chinadenli.net/article38/cohcsp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、網(wǎng)站設(shè)計(jì)、電子商務(wù)、定制網(wǎng)站、建站公司、網(wǎng)站策劃
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容