精品综合在线,va亚洲va日韩不卡在线观看,久久亚洲影视http://www.aygfsteel.com/lizongbo/category/25370.htmlhttp://618119.comzh-cnSun, 28 Oct 2007 17:11:39 GMTSun, 28 Oct 2007 17:11:39 GMT60新注冊了個獨立域名,使用獨立的bloghttp://www.aygfsteel.com/lizongbo/archive/2007/10/16/153162.htmllizongbo 的編程學習lizongbo 的編程學習Tue, 16 Oct 2007 01:46:00 GMThttp://www.aygfsteel.com/lizongbo/archive/2007/10/16/153162.htmlhttp://www.aygfsteel.com/lizongbo/comments/153162.htmlhttp://www.aygfsteel.com/lizongbo/archive/2007/10/16/153162.html#Feedback0http://www.aygfsteel.com/lizongbo/comments/commentRss/153162.htmlhttp://www.aygfsteel.com/lizongbo/services/trackbacks/153162.html
http://618119.com

新的blog rss訂閱地址: http://feed.feedsky.com/lizongbo

從最早的 http://blog.csdn.net/lizongbo,

到 http://blog.donews.com/lizongbo

再到http://www.aygfsteel.com/lizongbo

現在終于擁有自己的域名和獨立的blog了。  閱讀全文

lizongbo 的編程學習 2007-10-16 09:46 發表評論
]]>
java版discuz開發步驟http://www.aygfsteel.com/lizongbo/archive/2007/08/29/140766.htmllizongbo 的編程學習lizongbo 的編程學習Wed, 29 Aug 2007 01:43:00 GMThttp://www.aygfsteel.com/lizongbo/archive/2007/08/29/140766.htmlhttp://www.aygfsteel.com/lizongbo/comments/140766.htmlhttp://www.aygfsteel.com/lizongbo/archive/2007/08/29/140766.html#Feedback0http://www.aygfsteel.com/lizongbo/comments/commentRss/140766.htmlhttp://www.aygfsteel.com/lizongbo/services/trackbacks/140766.html1.搭建php版運行環境,包括數據庫和discuz php版本的運行,用于觀察了解
2.搭建java web應用基礎庫,
3.對沒有主鍵的標增加主鍵,用工具生成dao 層代碼.(注意jdbc的url里需要寫上charset)
4.生成logic層代碼
5.對應每個控制層的php,轉換成對應的spring mvc中的controller. 先從簡單的faq.php做起
action映射使用.php后綴.

視圖層使用jsp+jstl.

 


 



lizongbo 的編程學習 2007-08-29 09:43 發表評論
]]>
java discuz的開發筆記-模板代碼轉換http://www.aygfsteel.com/lizongbo/archive/2007/08/29/140764.htmllizongbo 的編程學習lizongbo 的編程學習Wed, 29 Aug 2007 01:42:00 GMThttp://www.aygfsteel.com/lizongbo/archive/2007/08/29/140764.htmlhttp://www.aygfsteel.com/lizongbo/comments/140764.htmlhttp://www.aygfsteel.com/lizongbo/archive/2007/08/29/140764.html#Feedback1http://www.aygfsteel.com/lizongbo/comments/commentRss/140764.htmlhttp://www.aygfsteel.com/lizongbo/services/trackbacks/140764.html由于原有模板是以.htm方式存在的,
在轉換成jsp方式時,對其中很多通用的代碼,可以通過替換的方式直接轉換為jstl語法的.
步驟如下:

1.首先將所有的htm文件名替換成jsp,
在命令行下運行 rename *.htm *.jsp即可.

2.將bbs\forumdata\cache\style_1.php中的css變量TABLEWIDTH等,
替換成類似${crtStyles['TABLEWIDTH']}的jstl語法.
全部只能手工替換

3.將*.jsp中的{lang forum_favorite}等替換成類似 <fmt:message key="faq" bundle="${forum_favorite}"/>
使用正則表達式進行替換:
editplus中的 查找內容為: {lang (.+)},替換內容為:<fmt:message key="faq" bundle="${\1}"/>
Jbuilder中的查找內容為 \{lang (.+)\},Pattern為:Regular Expressions,
替換內容為:(暫時未寫出來,打算寫程序進行替換操作)

用java程序替換的核心代碼為:

 //替換樣式變量
             content = content.replaceAll("FORMHASH", "formhash");
             //替換樣式變量 ${crtStyle['TABLEWIDTH']}
       content = content.replaceAll("\\{([A-Z0-9]+)\\}", "\\${crtStyle\\['$1'\\]}");
             //替換國際化定義
             //content = content.replaceAll("\\{lang (.+?)\\}",
             //                             "<fmt:message key=\"$1\" bundle=\"\\$\\{templates\\}\"/>");
             //對標簽屬性里的值暫時不替換
             content = content.replaceAll("([^\"])\\{lang (.+?)\\}",
       "$1<fmt:message key=\"$2\" bundle=\"\\$\\{templates\\}\"/>");

             //替換單層的屬性訪問
             content = content.replaceAll("\\$([a-z]+?)\\[([a-z]+?)\\]",
                                   "\\$\\{$1\\['$2'\\]\\}");
             //替換標題部分的聲明
             content = content.replaceAll("\\{template header\\}",
                                   "<%@page pageEncoding=\"UTF-8\" " +
                                   "contentType=\"text/html;" +
                                   " charset=UTF-8\"%>\n"
                                   + "<%@include file=\"/WEB-INF/" +
                                   "inc/taglibs.jspf\"%>\n" +
                                   "<jsp:include flush=\"true\" " +
                                   "page=\"header.jsp\"/>\n");
             ////替換底部部分的聲明
             content = content.replaceAll("\\{template footer\\}",
                                   "\n<jsp:include flush=\"true\" " +
                                   "page=\"footer.jsp\"/>");

             //替換其它引用聲明
             content = content.replaceAll("\\{template (.+?)\\}",
                                   "\n<jsp:include flush=\"true\" " +
                                   "page=\"$1.jsp\"/>");
             //替換url定義
       content = content.replaceAll("\\$indexname", "\\${settings.indexname}");
             //替換網站名字
             content = content.replaceAll("\\$bbname", "\\${settings.bbname}");
             //替換導航標簽
             content = content.replaceAll("\\$navigation", "\\${navigation}");
             //替換一些變量
             //content = content.replaceAll("\\$pid", "\\${pid}");
       content = content.replaceAll("\\$([a-z_]+)(\"|<|\\))", "\\${$1}$2");



lizongbo 的編程學習 2007-08-29 09:42 發表評論
]]>
java discuz的開發筆記-需要轉換實現機制的模塊http://www.aygfsteel.com/lizongbo/archive/2007/08/29/140763.htmllizongbo 的編程學習lizongbo 的編程學習Wed, 29 Aug 2007 01:41:00 GMThttp://www.aygfsteel.com/lizongbo/archive/2007/08/29/140763.htmlhttp://www.aygfsteel.com/lizongbo/comments/140763.htmlhttp://www.aygfsteel.com/lizongbo/archive/2007/08/29/140763.html#Feedback4http://www.aygfsteel.com/lizongbo/comments/commentRss/140763.htmlhttp://www.aygfsteel.com/lizongbo/services/trackbacks/140763.html
前言:discuz是一個很流行的 php論壇,一時好奇,打算學習并將其功能用java實現。
但是個人精力有限,只試著做了很小的一點功能。
但是在此過程中總結了一些經驗:

需要轉換實現機制的模塊



1.計劃任務
由于php受語言限制,必須靠外界的訪問去觸發計劃任務,而java則可以通過qutarz來做定時任務.
因此可以采取spring配置 qutarz的方式去設置定時任務.

2.風格機制
使用.jsp,使用jstl語法,允許用戶寫jstl
依然按目錄存放到templates目錄下,每個風格為一個文件夾.

3.緩存機制
使用oscache 標簽 來緩存頁面的方式.

4.特殊標簽的解析 hidden標簽,reply標簽
采取在顯示的時候,進行 jsp:include page="/tag/hidden.jsp" 這樣的方式來實現.

5.日歷選擇框: 使用jscalendar

6.頁面gzip壓縮,使用專門的gzip過濾器.

7.全文檢索,使用compass.

8.視圖層的模板.
discuz 已經使用了 mvc的模式,只是使用自己開發的模板技術,
 D:\xampp\htdocs\bbs\templates每個文件夾為一個主題,每個主題內對應的是各種視圖的htm.
因此在用java實現的時候,使用spring mvc ,
視圖層使用jsp來展示.
其中頁面的布局分為三段
{template header} 是最上面的導航部分
{template footer} 是最下方的版權申明等部分.
中間部分為各具體模塊的視圖.
后臺則是使用的固定框架,然后來合成內容的.

9.國際化支持
discuz使用的是 .lang.php定義數組的方式實現的,而且一次只支持一種語言
而java開發則使用I18N方式.多種語言均使用同一個系統.

 

 1.php的array功能非常強大,而java中只能用map和list結合起來處理.
2.在一個http請求中php的變量幾乎都是全局生效,而jstl中,則可以放到requestScope中.

1.discuz的有些表的主鍵不是自動增長的,因此不能夠生成@GeneratedValue(strategy = GenerationType.AUTO)的注釋.
這些表有: new String[] {
      "validating", "trades", "relatedthreads", "pushedthreads", "polls",
      "onlinetime", "memberspaces", "memberfields", "forumfields",
      "admingroups", "adminactions", "activities"}

2.mysql的hibernate dao單元測試中,insert是無法回滾的,而delete卻可以不操作數據庫,
因此crud單元測試的時候,導致不停的插入數據卻沒有刪除數據.
解決辦法,在 crud 測試方法的最后加上一行代碼:  this.setComplete();

3.mysql的jdbc需要幾個特殊設置
a.字符編碼集必須指定.
b.對于"0000-00-00" 這樣的默認日期,在轉化成java.sql.Date的時候會出錯,因此需要加上個zeroDateTimeBehavior屬性.

datasource.url=jdbc:mysql://localhost:3306/discuz?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull

4.mysql的jdbc驅動存在bug :  http://bugs.mysql.com/bug.php?id=22215

在usergroups 表中, readaccess字段是 tinyint(3)類型,而有值為200的,mysql的jdbc就會報錯,說數字越界了.

java.sql.SQLException: '200' in column '1' is outside valid range for the
datatype TINYINT.

暫時無解決辦法,采取修改200為20回避之.
(update:后來使用Short代替byte類型)
discuz 已經使用了 mvc的模式,只是使用自己開發的模板技術,
 D:\xampp\htdocs\bbs\templates每個文件夾為一個主題,每個主題內對應的是各種視圖的htm.

因此在用java實現的時候,使用spring mvc ,

視圖層使用jspx來展示.


其中頁面的布局分為三段

{template header} 是最上面的導航部分

{template footer} 是最下方的版權申明等部分.

中間部分為各具體模塊的視圖.

 

后臺則是使用的固定框架,然后來合成內容的.



 



lizongbo 的編程學習 2007-08-29 09:41 發表評論
]]>
主站蜘蛛池模板: 苏尼特右旗| 封丘县| 保德县| 彩票| 张掖市| 丰县| 隆尧县| 都昌县| 通榆县| 嵊泗县| 潮州市| 石嘴山市| 阿拉善左旗| 吴桥县| 福泉市| 红原县| 林周县| 广宁县| 平湖市| 卓资县| 泗洪县| 张掖市| 禹城市| 昌黎县| 炎陵县| 万荣县| 澄江县| 遵义市| 哈尔滨市| 开阳县| 沙湾县| 南开区| 崇仁县| 宝山区| 东源县| 洛隆县| 泰宁县| 黑龙江省| 广德县| 弋阳县| 南京市|