1. Tomcat config file, where you can change Tomcat's port number: <CATALINA_HOME>/conf/server.xml
?
<
?Host?...
?
>
?
?????? ...
???????
<
?Context??
path?
="/app1"
??docBase?
="app1"
??debug?
="0"
??reloadable?
="true"
?
/>
?
???????
<
?Context??
path?
="/app2"
??docBase?
="app2"
??debug?
="0"
??reloadable?
="true"
?
/>
?
???????
<
?Context??
path?
="root?url"
??docBase?
="root?dir?(or?the?path?of?.war)"
??debug?
="0"
??reloadable?
="note1"
?
>
?
< /
Host
>
??
note1: whether auto-reload the web application, when .class file is changed
????????????? 1) during developing, set reloadable=true
????????????? 2) after deployment, set reloadable=false
2. Some libs
/server/lib?
|
just for Tomcat
|
/shared/lib
|
for all web apps
|
/common/lib
|
both Tomcat and all web apps
|
/webapps/jcat/WEB-INF/lib
|
just present web app
|
?
3. Immobile Directory Structure (the names are also immobile, include uppercase/lowercase)?
???/jcat
???/jcat/WEB-INF
???/jcat/WEB-INF/web.xml
???/jcat/WEB-INF/classes
???/jcat/WEB-INF/lib
?????
Note: WEB-INF/classes
is loaded by tomcat before
WEB-INF/lib
, so classes has priority than lib
?
4.?Scopes
??????Application:在整個web應用程序內有效。對應于servelet中的ServletContext對象,Action中的獲取:getServlet().getServletContext()
??????Session:在一個用戶與服務器建立連接的整個過程中有效。Action中的獲取:httpServletRequest.getSession()
??????Request:在一個請求周期內有效。就是從你點擊頁面上的一個按鈕開始到服務器返回響應頁面為止(包括響應頁面)。
??????Page:僅在一個jsp頁面內有效。
*1*
?
Request in Struts: PageFrom (request.setAttribute by using Form)-->Action(request.getAttribute&setAttribute)-->PageTo (request.getAttribute by using EL)?
*2*?:
Parameter vs Attribute in request
???Parameter
是
URL
帶過來的參數,只能是個
String
,如
www.verican.com/test?para1=1¶2=ttt
???在
Action
中的調用:
request.getParameter("para1");?
???在響應頁面中的調用:
${param.para1}
(
param
是
EL
的隱藏對象)?
???Attribute
一般是
Form
帶過來的屬性,可以是任何對象
???
在
Action
中的調用:一般已經存在于
Form
對象中;
???在響應頁面中的調用:
${attributeName.xxx}?
(
EL
會自動調用
getXxx
方法,所以該
attribute
必須實現
getXxx
方法)
5. Web server跟蹤客戶狀態的四種方法(HTTP是無狀態的協議)
??? 1)建立含有跟蹤數據的隱藏表格字段
??? 2)重寫包含額外參數的URL
??? 3)使用持續的Cookie
??? 4)使用Servlet API中的Session機制
6. JavaBean的標準
???1) should be a public class
???2) should have a non-argument constructor
???3) fields should be privated, and using get & set to access them
???4) also can have some other functions as a common class
posted on 2006-06-23 09:11
Jcat 閱讀(389)
評論(0) 編輯 收藏 所屬分類:
Java