最近因?yàn)殚_(kāi)發(fā)需要,自己做了一個(gè)小的Demo部署在網(wǎng)上,具體網(wǎng)址
http://www.17chuxing.com,實(shí)現(xiàn)一個(gè)類似公交查詢的功能,目前基本上能夠正常運(yùn)行。
現(xiàn)在總結(jié)一下,以便以后查詢使用;
一、技術(shù)方面
1、demo的整體技術(shù)結(jié)構(gòu)采用比較簡(jiǎn)單的Struts+spring+hibernate,struts 可以定義全局的異常、返回值、攔截器,hibernate采用統(tǒng)一的Spring-hibernate模板進(jìn)行數(shù)據(jù)提交,減少開(kāi)發(fā)量。如果采用hiberante懶加載方式,需要手工flush(),web.xml需要增加lazyLoadingFilter;
<filter>
<filter-name>lazyLoadingFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
2、數(shù)據(jù)量較小采用了mySql作為數(shù)據(jù)庫(kù),采用mysql需要注意的是早期的mysql版本,表名區(qū)分大小寫(xiě),a 與A的結(jié)果不一樣;
3、在展現(xiàn)層方面采用sitemesh裝飾器對(duì)展現(xiàn)的頁(yè)面進(jìn)行渲染(包括樣式、頁(yè)頭、頁(yè)腳、統(tǒng)計(jì)代碼),保證每個(gè)網(wǎng)頁(yè)的風(fēng)格一致性,并且可以減少一定開(kāi)發(fā)工作量;
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
4、采用gzipFilter對(duì)請(qǐng)求進(jìn)行壓縮,減少每次請(qǐng)求所需網(wǎng)絡(luò)流量;
<filter>
<filter-name>gzipFilter</filter-name>
<filter-class>net.sf.ehcache.constructs.web.filter.GzipFilter</filter-class>
</filter>
5、首頁(yè)盡可能減少跳轉(zhuǎn)(redirect),因?yàn)槊看翁D(zhuǎn)都需要一定的時(shí)間;
二、部署流程
1、申請(qǐng)域名
2、選擇虛擬機(jī)托管商
3、部署程序
4、申請(qǐng)備案
三、其他方面;
1、向搜索引擎提交網(wǎng)站
2、其它思考點(diǎn),通過(guò)rewrite 技術(shù)實(shí)現(xiàn)反寫(xiě),生成相應(yīng)的靜態(tài)文件;
<filter>
<filter-name>rewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<!-- sets up log level (will be logged to context log)
can be: TRACE, DEBUG, INFO (default), WARN, ERROR, FATAL, log4j, commons, sysout:{level} (ie, sysout:DEBUG)
if you are having trouble using normal levels use sysout:DEBUG -->
<init-param>
<param-name>logLevel</param-name>
<param-value>commons</param-value>
</init-param>
<!-- set the amount of seconds the conf file will be checked for reload
can be a valid integer (0 denotes check every time,
-1 denotes no reload check, default -1) -->
<init-param>
<param-name>confReloadCheckInterval</param-name>
<param-value>-1</param-value>
</init-param>
</filter>
posted on 2012-04-25 13:16
民工二代 閱讀(519)
評(píng)論(0) 編輯 收藏