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 阅读(383)
评论(0) 编辑 收藏 所属分类:
Java