锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲午夜国产精品,国产亚洲精品va在线,亚洲依依成人亚洲社区http://m.tkk7.com/rory/Happy study,Happy work,Happy lifezh-cnMon, 12 May 2025 18:41:43 GMTMon, 12 May 2025 18:41:43 GMT60xstream瀵箈mlnode鐨勫睘鎬?attribute)瑙f瀽鐨勯棶棰榌鏇存柊]銆?/title><link>http://m.tkk7.com/rory/archive/2007/01/17/howto-dealwith-xstream-xmlnode-attribute.html</link><dc:creator>鑾</dc:creator><author>鑾</author><pubDate>Wed, 17 Jan 2007 10:24:00 GMT</pubDate><guid>http://m.tkk7.com/rory/archive/2007/01/17/howto-dealwith-xstream-xmlnode-attribute.html</guid><wfw:comment>http://m.tkk7.com/rory/comments/94475.html</wfw:comment><comments>http://m.tkk7.com/rory/archive/2007/01/17/howto-dealwith-xstream-xmlnode-attribute.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.tkk7.com/rory/comments/commentRss/94475.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/rory/services/trackbacks/94475.html</trackback:ping><description><![CDATA[xstream鏄釜濂戒笢瑗褲傚浜庨厤緗枃浠剁殑璇誨彇寰堟柟渚褲傚湪mybog涓垜灝辯敤鍒頒簡銆備笉榪囦粖澶╂墦綆楃敤yupoo鐨刟pi鏉ュ仛鐩稿唽銆傚彂鐜皒stream瀵逛簬xmlnode鐨刟ttribute瑙f瀽鏀寔涓嶆槸閭d箞鐨勫ソ銆?br />瀵逛簬榪欑鑺傜偣鏍煎紡鐨勯潪甯哥殑綆鍗?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">page</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">page</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">pages</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">pages</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">perpage</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">100</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">perpage</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">total</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">19</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">total</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">photos</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">photo</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">ff8080810fc8ac78010fd3f158d40a52</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">owner</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">ff8080810f1a387b010f1a83d6530dfc</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">owner</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">Gmail-2</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">title</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">host</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">host</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">20061230</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">dir</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">filename</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);">231905_1463411198</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">filename</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">photo</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">photos</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">></span></div><br />綆鍗曠殑alias涓涓嬪氨鍙互璇誨埌鍊間簡<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 0);">File聽file聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽File(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">src/test/java/com/jdkcn/test/result.xml</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />BufferedReader聽reader聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽BufferedReader(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽InputStreamReader(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽FileInputStream(file),聽</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">UTF-8</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />XStream聽stream聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽XStream();<br />stream.alias(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">result</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽YupooResult.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />stream.alias(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">photo</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,YupooPhoto.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />YupooResult聽result聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽(YupooResult)stream.fromXML(reader);</span></div>鍙槸Yupoo鐨刟pi榪斿洖鐨剎mlrpc鐨勭粨鏋滄槸榪欐牱鐨?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">result聽</span><span style="color: rgb(255, 0, 0);">page</span><span style="color: rgb(0, 0, 255);">="1"</span><span style="color: rgb(255, 0, 0);">聽pages</span><span style="color: rgb(0, 0, 255);">="1"</span><span style="color: rgb(255, 0, 0);">聽perpage</span><span style="color: rgb(0, 0, 255);">="100"</span><span style="color: rgb(255, 0, 0);">聽total</span><span style="color: rgb(0, 0, 255);">="19"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">photos</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">photo聽</span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="ff8080810fc8ac78010fd3f158d40a52"</span><span style="color: rgb(255, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽owner</span><span style="color: rgb(0, 0, 255);">="ff8080810f1a387b010f1a83d6530dfc"</span><span style="color: rgb(255, 0, 0);">聽title</span><span style="color: rgb(0, 0, 255);">="Gmail-2"</span><span style="color: rgb(255, 0, 0);">聽host</span><span style="color: rgb(0, 0, 255);">="4"</span><span style="color: rgb(255, 0, 0);"><br />聽聽聽聽聽聽聽聽聽聽聽聽dir</span><span style="color: rgb(0, 0, 255);">="20061230"</span><span style="color: rgb(255, 0, 0);">聽filename</span><span style="color: rgb(0, 0, 255);">="231905_1463411198"</span><span style="color: rgb(255, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">photos</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">result</span><span style="color: rgb(0, 0, 255);">></span></div>榪欐牱灝眑oad涓嶅埌鍊間簡銆傛病娉曞幓mailist閲岄潰鎵劇瓟妗堬紝鏋滅劧鏈変漢闂?br /><pre><font color="#ff9900">Hello, I am not sure about the subject but here is what I needed help for: XML: <field name="value">I am a Field.</field> I have already tried several structures and nothing seem to work. Is this possible for XStream? :) How is the Java class form to support this? Thanks!</font><br /><br /><br /><br /><br />鏈変漢鍥炵瓟鏄湅Converter鐨勬枃妗c傛灉鐒舵壘鍒扮瓟妗堜簡銆?br />鑷繁鍐欎竴涓猚onverter灝卞彲浠ヤ簡銆?br />涓嬮潰鏄垜鐨刢onverter<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);">聽com.jdkcn.xstream;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽java.util.ArrayList;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽java.util.List;<br /><br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽com.jdkcn.yupoo.YupooPhoto;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽com.jdkcn.yupoo.YupooResult;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽com.thoughtworks.xstream.converters.Converter;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽com.thoughtworks.xstream.converters.MarshallingContext;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽com.thoughtworks.xstream.converters.UnmarshallingContext;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽com.thoughtworks.xstream.io.HierarchicalStreamReader;<br /></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);">聽com.thoughtworks.xstream.io.HierarchicalStreamWriter;<br /><br /></span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />聽*聽</span><span style="color: rgb(128, 128, 128);">@author</span><span style="color: rgb(0, 128, 0);">聽<a聽href="mailto:rory.cn@gmail.com">somebody</a><br />聽*聽</span><span style="color: rgb(128, 128, 128);">@since</span><span style="color: rgb(0, 128, 0);">聽Jan聽16,聽2007聽6:12:35聽PM<br />聽*聽</span><span style="color: rgb(128, 128, 128);">@version</span><span style="color: rgb(0, 128, 0);">聽$Id聽YupooResultConverter.java$<br />聽</span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">聽YupooResultConverter聽</span><span style="color: rgb(0, 0, 255);">implements</span><span style="color: rgb(0, 0, 0);">聽Converter聽{<br />聽聽聽聽</span><span style="color: rgb(0, 128, 0);">/*</span><span style="color: rgb(0, 128, 0);">聽(non-Javadoc)<br />聽聽聽聽聽*聽@see聽com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object,聽com.thoughtworks.xstream.io.HierarchicalStreamWriter,聽com.thoughtworks.xstream.converters.MarshallingContext)<br />聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">聽marshal(Object聽obj,聽HierarchicalStreamWriter聽writer,聽MarshallingContext聽context)聽{<br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">聽FIXME聽unfinish.</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">聽聽聽聽}<br /><br />聽聽聽聽</span><span style="color: rgb(0, 128, 0);">/*</span><span style="color: rgb(0, 128, 0);">聽(non-Javadoc)<br />聽聽聽聽聽*聽@see聽com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader,聽com.thoughtworks.xstream.converters.UnmarshallingContext)<br />聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">聽Object聽unmarshal(HierarchicalStreamReader聽reader,聽UnmarshallingContext聽context)聽{<br />聽聽聽聽聽聽聽聽YupooResult聽result聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽YupooResult();<br />聽聽聽聽聽聽聽聽result.setPage(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽Integer(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">page</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)));<br />聽聽聽聽聽聽聽聽result.setPages(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽Integer(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">pages</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)));<br />聽聽聽聽聽聽聽聽result.setPerpage(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽Integer(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">perpage</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)));<br />聽聽聽聽聽聽聽聽result.setTotal(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽Integer(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">total</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)));<br />聽聽聽聽聽聽聽聽reader.moveDown();<br />聽聽聽聽聽聽聽聽List</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">YupooPhoto</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">聽photos聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">YupooPhoto</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">();<br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(reader.hasMoreChildren())聽{<br />聽聽聽聽聽聽聽聽聽聽聽聽reader.moveDown();<br />聽聽聽聽聽聽聽聽聽聽聽聽YupooPhoto聽photo聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽YupooPhoto();<br />聽聽聽聽聽聽聽聽聽聽聽聽photo.setDir(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">dir</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽photo.setFilename(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">filename</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽photo.setHost(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">host</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽photo.setId(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">id</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽photo.setOwner(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">owner</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽photo.setTitle(reader.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">title</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />聽聽聽聽聽聽聽聽聽聽聽聽photos.add(photo);<br />聽聽聽聽聽聽聽聽聽聽聽聽reader.moveUp();<br />聽聽聽聽聽聽聽聽}<br />聽聽聽聽聽聽聽聽result.setPhotos(photos);<br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽result;<br />聽聽聽聽}<br />聽聽聽聽</span><span style="color: rgb(0, 128, 0);">/*</span><span style="color: rgb(0, 128, 0);">聽(non-Javadoc)<br />聽聽聽聽聽*聽@see聽com.thoughtworks.xstream.converters.ConverterMatcher#canConvert(java.lang.Class)<br />聽聽聽聽聽</span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />聽聽聽聽</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">boolean</span><span style="color: rgb(0, 0, 0);">聽canConvert(Class聽clazz)聽{<br />聽聽聽聽聽聽聽聽</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">聽clazz.equals(YupooResult.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽}<br />}<br /></span></div><br />鐒跺悗璋冪敤鐨勫湴鏂逛慨鏀逛竴涓嬪氨ok浜嗐?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 0);">XStream聽stream聽</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">聽</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽XStream();<br />stream.registerConverter(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">聽YupooResultConverter());<br />stream.alias(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">result</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽YupooResult.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);</span></div><br /><br /><br />鍙傝?<br /><a >http://xstream.codehaus.org/converter-tutorial.html</a></pre><br />2007騫?鏈?8鏃ユ洿鏂般?br />榪欓噷鎰熻阿緗戝弸 <a id="AjaxHolder_Comments_CommentList_ctl00_NameLink" target="_blank">Ivan Chen錛堣タ婊級</a>聽鐨勬彁紺恒傚師鏉ユ柊鐗堢殑xstream鍙互綆鍗曠殑瑙e喅浜嗐傚湪1.2.1鐨刣oc閲岄潰鎵懼埌浜嗚繖涓袱涓柟娉曘?br /><h3>useAttributeFor</h3><pre>public void <b>useAttributeFor</b>(java.lang.String聽fieldName, java.lang.Class聽type)</pre><dl><dd>Use an XML attribute for a field or a specific type. <p></p></dd><dd><dl><dt><b>Parameters:</b></dt><dd><code>fieldName</code> - the name of the field </dd><dd><code>type</code> - the Class of the type to be rendered as XML attribute </dd><dt><b>Throws:</b></dt><dd><code><a title="class in com.thoughtworks.xstream" >XStream.InitializationException</a></code> - if no <a title="class in com.thoughtworks.xstream.mapper" ><code>AttributeMapper</code></a> is available </dd><dt><b>Since:</b></dt><dd>1.2</dd></dl></dd></dl><hr /><a name="useAttributeFor(java.lang.Class)"><!-- --></a><h3>useAttributeFor</h3><pre>public void <b>useAttributeFor</b>(java.lang.Class聽type)</pre><dl><dd>Use an XML attribute for an arbotrary type. <p></p></dd><dd><dl><dt><b>Parameters:</b></dt><dd><code>type</code> - the Class of the type to be rendered as XML attribute </dd><dt><b>Throws:</b></dt><dd><code><a title="class in com.thoughtworks.xstream" >XStream.InitializationException</a></code> - if no <a title="class in com.thoughtworks.xstream.mapper" ><code>AttributeMapper</code></a> is available </dd><dt><b>Since:</b></dt><dd>1.2</dd></dl></dd></dl><br />榪欎袱涓柟娉曢兘鏄粠1.2寮濮嬫敮鎸佺殑銆?br />涔熶笉鐢ㄨ嚜宸卞啓converter浜嗐傝繖鏍峰氨鍙互浜?br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; font-size: 13px; width: 98%; background-color: rgb(238, 238, 238);"><span style="color: rgb(0, 0, 0);">聽聽聽聽聽聽聽聽stream.alias(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">result</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽YupooResult.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">page</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽Integer.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">pages</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽Integer.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">perpage</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽Integer.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">total</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽Integer.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.alias(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">photo</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽YupooPhoto.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">id</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽String.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">owner</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽String.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">title</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽String.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">host</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽String.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">dir</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽String.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);<br />聽聽聽聽聽聽聽聽stream.useAttributeFor(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">filename</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,聽String.</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">);</span></div><a target="_blank"><br /><img alt="鍒涢犲叡鐢ㄥ崗璁?緗插悕,闈炲晢涓?淇濇寔涓鑷? src="http://leaf.jdk.cn/rights.gif" border="0" height="31" width="88" /></a>聽聽 闄ょ粡鐗瑰埆娉ㄦ槑澶?鏈枃绔犵増鏉冨綊<strong><a class="" ><font color="#6b6b52">鑾娉℃場</font></a></strong>鎵鏈? <br /><font color="#ff0000">緗插悕,闈炲晢涓氱敤閫?淇濇寔涓鑷?</font>聽聽聽<a title="鑾娉℃場" target="_blank">somebody(鑾)</a><img src ="http://m.tkk7.com/rory/aggbug/94475.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/rory/" target="_blank">鑾</a> 2007-01-17 18:24 <a href="http://m.tkk7.com/rory/archive/2007/01/17/howto-dealwith-xstream-xmlnode-attribute.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍙堟槸涔辯爜闂-Filter 閰嶇疆涔熷緢閲嶈http://m.tkk7.com/rory/archive/2006/12/27/character_encoding_problem_filtermapping_position.html鑾鑾Wed, 27 Dec 2006 02:37:00 GMThttp://m.tkk7.com/rory/archive/2006/12/27/character_encoding_problem_filtermapping_position.htmlhttp://m.tkk7.com/rory/comments/90236.htmlhttp://m.tkk7.com/rory/archive/2006/12/27/character_encoding_problem_filtermapping_position.html#Feedback3http://m.tkk7.com/rory/comments/commentRss/90236.htmlhttp://m.tkk7.com/rory/services/trackbacks/90236.html聽 涓婂懆鏇存柊浜嗕竴涓媘yblog,娣誨姞浜嗕竴涓狥ilter錛屽仛緇熻璁塊棶鐢ㄣ傚彲鏄悗鏉ュ彂鐜板嚭鐜頒貢鐮侀棶棰樹簡銆傛壘浜嗗緢涔呴兘娌℃湁鎵懼埌闂銆俤ebug鐨勬椂鍊欑湅鍒?CharacterEncodingFilter紜疄鏄墽琛屼簡銆備笉榪囧氨鏄病鏈夋晥鏋溿傛墽琛屼箣鍓嶆槸ISO-8859-1緙栫爜鐨勶紝鎵ц涔嬪悗榪樻槸錛?CharacterEncodingFilter灝辨病鏈夎搗鍒頒綔鐢ㄣ傚悗鏉ョ粓浜庢壘鍒伴棶棰樼殑鍘熷洜浜嗐傚師鏉ユ槸Filter閰嶇疆鍏堝悗欏哄簭鐨勫師鍥犮?br />聽聽聽聽聽聽 鍒氬紑濮嬬殑閰嶇疆鏄繖鏍風殑:

聽聽聽聽 < filter-mapping >
聽聽聽聽聽聽聽聽
< filter-name > requestCounterFilter </ filter-name >
聽聽聽聽聽聽聽聽
< url-pattern > *.jhtml </ url-pattern >
聽聽聽聽
</ filter-mapping >
聽聽
聽聽聽聽
< filter-mapping >
聽聽聽聽聽聽聽聽
< filter-name > encodingFilter </ filter-name >
聽聽聽聽聽聽聽聽
< url-pattern > /dwr/* </ url-pattern >
聽聽聽聽
</ filter-mapping >
聽聽聽聽
聽聽聽聽
< filter-mapping >
聽聽聽聽聽聽聽聽
< filter-name > encodingFilter </ filter-name >
聽聽聽聽聽聽聽聽
< url-pattern > *.jhtml </ url-pattern >
聽聽聽聽
</ filter-mapping >
聽聽聽聽
聽聽聽聽
< filter-mapping >
聽聽聽聽聽聽聽聽
< filter-name > encodingFilter </ filter-name >
聽聽聽聽聽聽聽聽
< url-pattern > *.jsp </ url-pattern >
聽聽聽聽
</ filter-mapping >

聽 鍏堢粡榪囬偅涓粺璁$殑filter鐒跺悗鍐嶇粡榪囩紪鐮佺殑filter銆傝繖鏍風殑璇濈紪鐮佺殑filter灝變笉璧蜂綔鐢ㄤ簡銆傚彧瑕佸惂緙栫爜鐨刦ilter鏀懼埌鏈鍓嶉潰灝辨病鏈夐棶棰樹簡銆傛敼鎴愯繖鏍峰氨濂姐?br />

聽聽聽聽 < filter-mapping >
聽聽聽聽聽聽聽聽
< filter-name > encodingFilter </ filter-name >
聽聽聽聽聽聽聽聽
< url-pattern > /dwr/* </ url-pattern >
聽聽聽聽
</ filter-mapping >
聽聽聽聽
聽聽聽聽
< filter-mapping >
聽聽聽聽聽聽聽聽
< filter-name > encodingFilter </ filter-name >
聽聽聽聽聽聽聽聽
< url-pattern > *.jhtml </ url-pattern >
聽聽聽聽
</ filter-mapping >
聽聽聽聽
聽聽聽聽
< filter-mapping >
聽聽聽聽聽聽聽聽
< filter-name > encodingFilter </ filter-name >
聽聽聽聽聽聽聽聽
< url-pattern > *.jsp </ url-pattern >
聽聽聽聽
</ filter-mapping >
聽聽聽聽
聽聽聽聽
< filter-mapping >
聽聽聽聽聽聽聽聽
< filter-name > requestCounterFilter </ filter-name >
聽聽聽聽聽聽聽聽
< url-pattern > *.jhtml </ url-pattern >
聽聽聽聽
</ filter-mapping >


浠ュ悗澶у涓瀹氳娉ㄦ剰鍟娿傞『搴忛棶棰樹篃鏄緢閲嶈鐨勩?br />鍒涢犲叡鐢ㄥ崗璁?緗插悕,闈炲晢涓?淇濇寔涓鑷? src=聽聽 闄ょ粡鐗瑰埆娉ㄦ槑澶?鏈枃绔犵増鏉冨綊鑾娉℃場鎵鏈?
緗插悕,闈炲晢涓氱敤閫?淇濇寔涓鑷?聽聽聽somebody(鑾)



鑾 2006-12-27 10:37 鍙戣〃璇勮
]]>
tuckey urlrewrite 3.x鐨勯棶棰?/title><link>http://m.tkk7.com/rory/archive/2006/12/12/tuckey-urlrewrite_3-querystring-problem.html</link><dc:creator>鑾</dc:creator><author>鑾</author><pubDate>Tue, 12 Dec 2006 02:33:00 GMT</pubDate><guid>http://m.tkk7.com/rory/archive/2006/12/12/tuckey-urlrewrite_3-querystring-problem.html</guid><wfw:comment>http://m.tkk7.com/rory/comments/87151.html</wfw:comment><comments>http://m.tkk7.com/rory/archive/2006/12/12/tuckey-urlrewrite_3-querystring-problem.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/rory/comments/commentRss/87151.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/rory/services/trackbacks/87151.html</trackback:ping><description><![CDATA[鏄ㄥぉ鏅氫笂閰嶇疆myblog鐨剅ewrite銆傚彂鐜頒竴涓鎬殑闂銆傜敱浜庣幇鍦ㄤ嬌鐢ㄧ殑榪欎釜pjblog錛屼負浜嗚鎼滅儲寮曟搸鏀跺綍鐨勮繛鎺ユ湁鏁堛傛垜鎯蟲妸鍘熸潵鐨刟sp榪炴帴rewrite鍒版垜鐨勬柊紼嬪簭涓婇潰銆傛墍浠ユ湁榪欐牱涓鏉¤鍒欍?br /><br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><span style="COLOR: rgb(0,0,0)">聽聽聽聽</span><span style="COLOR: rgb(0,0,255)"><</span><span style="COLOR: rgb(128,0,0)">rule</span><span style="COLOR: rgb(0,0,255)">></span><span style="COLOR: rgb(0,0,0)"><br />聽聽聽聽聽聽聽聽</span><span style="COLOR: rgb(0,0,255)"><</span><span style="COLOR: rgb(128,0,0)">from</span><span style="COLOR: rgb(0,0,255)">></span><span style="COLOR: rgb(0,0,0)">^/article.asp\?id=(.*)$</span><span style="COLOR: rgb(0,0,255)"></</span><span style="COLOR: rgb(128,0,0)">from</span><span style="COLOR: rgb(0,0,255)">></span><span style="COLOR: rgb(0,0,0)"><br />聽聽聽聽聽聽聽聽</span><span style="COLOR: rgb(0,0,255)"><</span><span style="COLOR: rgb(128,0,0)">to聽</span><span style="COLOR: rgb(255,0,0)">type</span><span style="COLOR: rgb(0,0,255)">="redirect"</span><span style="COLOR: rgb(0,0,255)">></span><span style="COLOR: rgb(0,0,0)">/entry/$1.jhtml</span><span style="COLOR: rgb(0,0,255)"></</span><span style="COLOR: rgb(128,0,0)">to</span><span style="COLOR: rgb(0,0,255)">></span><span style="COLOR: rgb(0,0,0)"><br />聽聽聽聽</span><span style="COLOR: rgb(0,0,255)"></</span><span style="COLOR: rgb(128,0,0)">rule</span><span style="COLOR: rgb(0,0,255)">></span></div>聽聽聽聽 浣嗘槸鎴戣繖鏍風殑榪炴帴鎬繪槸鍖歸厤涓嶅埌錛屽彧瑕佸幓鎺夐偅涓紵灝卞彲浠ヤ簡銆傝繖涓鍒欒〃杈懼紡鏄病鏈夐棶棰樼殑銆?article.asp?id=64鏄彲浠ュ尮閰嶇殑鍒扮殑銆?br />聽聽聽 鍚庢潵鐪?.0鐨刴anual (http://tuckey.org/urlrewrite/manual/3.0/)鎵嶅彂鐜板師鏉ユ槸榪欎釜鐨勯棶棰樸?br /><h3><urlrewrite> element</h3><p>The top level element.</p><table cellspacing="0"><tbody><tr><th>Attribute</th><th>Possible Value</th><th>Explanation</th></tr><tr><td rowspan="2">default-match-type <br /><small>(optional)</small></td><td><b>regex</b> (default)</td><td>All rules and thier conditions will be processed using the Java Regular Expression engine (unless <code>match-type</code> is specified on a rule).</td></tr><tr><td>wildcard</td><td>All rules and thier conditions will be processed using the <a >Wildcard Expression engine</a> (unless <code>match-type</code> is specified on a rule).</td></tr><tr><td rowspan="3">decode-using <br /><small>(optional)</small></td><td><b>utf8</b> (default)</td><td>When URL is decoded UTF-8 will be used.</td></tr><tr><td>null</td><td>Do not decode.</td></tr><tr><td>[encoding]</td><td>Any string representing a supported character encoding eg, ISO-8859-1. See <a >Java Charset Object</a> for more info. </td></tr><tr><td style="FONT-WEIGHT: bold; COLOR: rgb(0,0,255)" rowspan="2">use-query-string <br /><small>(optional)</small></td><td><b>false</b> (default)</td><td>The query string will <em>not</em> be appended to the url that the "from" element matches against.</td></tr><tr><td>true</td><td>The query string will be appended to the url that the "from" element matches against.</td></tr><tr><td rowspan="2">use-context <br /><small>(optional)</small></td><td><b>false</b> (default)</td><td>The context path will <em>not</em> be added to the url that the "from" element matches against.</td></tr><tr><td>true</td><td>The context path will be added to the url that the "from" element matches against.</td></tr></tbody></table><br />灝辨槸閭d釜use-query-string 鐨勯棶棰橈紝榛樿鐨勬槸涓嶄嬌鐢╭uery-string灝辨槸鎶?鍚庨潰鐨勯兘蹇界暐浜嗐傛墍浠ュ氨涓嶈兘鍖歸厤鍒頒簡銆傚彧瑕佸湪<urlrewrite>閲岄潰鍔犱竴涓睘鎬у氨鍙互浜嗐?br /><div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)"><span style="COLOR: rgb(0,0,255)"><</span><span style="COLOR: rgb(128,0,0)">urlrewrite聽</span><span style="COLOR: rgb(255,0,0)">use-query-string</span><span style="COLOR: rgb(0,0,255)">="true"</span><span style="COLOR: rgb(0,0,255)">></span><span style="COLOR: rgb(0,0,0)"><br />聽聽聽聽<img alt="" src="http://m.tkk7.com/images/dot.gif" /><br /></span><span style="COLOR: rgb(0,0,255)"></</span><span style="COLOR: rgb(128,0,0)">urlrewrite</span><span style="COLOR: rgb(0,0,255)">></span></div><p><a target="_blank"><img height="31" alt="鍒涢犲叡鐢ㄥ崗璁?緗插悕,闈炲晢涓?淇濇寔涓鑷? src="http://leaf.jdk.cn/rights.gif" width="88" border="0" /></a>聽聽 闄ょ粡鐗瑰埆娉ㄦ槑澶?鏈枃绔犵増鏉冨綊<strong><a class="" ><font color="#6b6b52">鑾娉℃場</font></a></strong>鎵鏈? <br /><font color="#ff0000">緗插悕,闈炲晢涓氱敤閫?淇濇寔涓鑷?</font>聽聽聽<a title="鑾娉℃場" target="_blank">somebody(鑾)</a></p><img src ="http://m.tkk7.com/rory/aggbug/87151.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/rory/" target="_blank">鑾</a> 2006-12-12 10:33 <a href="http://m.tkk7.com/rory/archive/2006/12/12/tuckey-urlrewrite_3-querystring-problem.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SpringXmlrpcServiceExporter for xmlrpc3.xhttp://m.tkk7.com/rory/archive/2006/10/22/spring_xmlrpc3_service_exporter.html鑾鑾Sun, 22 Oct 2006 08:12:00 GMThttp://m.tkk7.com/rory/archive/2006/10/22/spring_xmlrpc3_service_exporter.htmlhttp://m.tkk7.com/rory/comments/76628.htmlhttp://m.tkk7.com/rory/archive/2006/10/22/spring_xmlrpc3_service_exporter.html#Feedback0http://m.tkk7.com/rory/comments/commentRss/76628.htmlhttp://m.tkk7.com/rory/services/trackbacks/76628.html聽聽聽聽聽聽鎴戜滑鐨勯」鐩敤鍒頒簡xmlrpc,涓嶈繃榪樻槸鐢ㄧ殑2.x鐗堟湰鐨勩傜敱浜巟mlrpc3.x鍦版帹鍑恒傛彁渚涗簡NULL,Serializable絳夌殑鏀寔錛屽皢鍘熸潵鐨凥ashtable鏀規垚浜哅ap,Vector鏀規垚浜哃ist銆傞兘鏄笉閿欑殑榪涙銆傛墍浠ユ垜浠喅瀹氫粠xmlrpc2.x鍗囩駭鍒皒mlrpc3.x.
聽聽聽聽聽聽鍦╯pring閲岄潰鏈夊嚑涓猄erviceExporter錛宱rg.springframework.remoting.rmi.RmiServiceExporter銆乷rg.springframework.remoting.caucho.HessianServiceExporter銆乷rg.springframework.remoting.caucho.BurlapServiceExporter銆備笉榪囨病鏈墄mlrpc鐨剆erviceExporter錛屽師鏉ユ垜浠槸鑷繁灝佽鐨刋mlRpcServer,鐢╯ervlet鎻愪緵鏈嶅姟銆?eg:http://localhost:8080/community/service/xmlrpc)娌℃湁鍜宻pring闆嗘垚铏界劧鐢ㄤ簡spring銆?br />聽聽聽 鑰冭檻鍒皊pring鐨勪究鍒╀互鍙婇厤緗殑鍚屾剰鎴戝喅瀹氬皢xmlrpcService鏀懼叆spring涓倄mlrpc3.x鍜寈mlrpc2.x鐨勪唬鐮佸熀鏈笂娌℃湁涓鏍風殑銆傛敼浜嗗緢澶氫笢瑗褲傞櫎浜嗙被鍨嬪彉鍖栦箣澶栵紝榪樻坊鍔犱簡瀵瑰紓甯哥殑鏀寔銆傝緇嗕俊鎭鍙傜収xmlrpc3.x婧愪唬鐮併?br />XmlRpcServiceExporter.java

package 聽com.jdkcn.xmlrpc;

import 聽javax.servlet.ServletException;

/**
聽*聽
@author 聽<a聽href="mailto:rory.cn@gmail.com">somebody</a>
聽*聽
@since 聽2006-9-27聽03:59:22聽pm
聽*聽
@version 聽$Id聽XmlRpcServiceExporter.java$
*/
public class 聽XmlRpcServiceExporter聽 extends 聽RemoteExporter聽 implements
聽聽聽聽聽聽聽聽Controller,聽InitializingBean聽{
聽聽聽聽
聽聽聽聽
private 聽XmlRpcServletServer聽server;
聽聽聽聽
聽聽聽聽
public 聽String聽serviceName;
聽聽聽聽
聽聽聽聽
public 聽Resource聽configFile;
聽聽聽聽
聽聽聽聽
public 聽Boolean聽enabledForExtensions;
聽聽聽聽
聽聽聽聽
public void 聽setEnabledForExtensions(Boolean聽enabledForExtensions)聽{
聽聽聽聽聽聽聽聽
this .enabledForExtensions聽 = 聽enabledForExtensions;
聽聽聽聽}

聽聽聽聽
public void 聽setConfigFile(Resource聽configFile)聽{
聽聽聽聽聽聽聽聽
this .configFile聽 = 聽configFile;
聽聽聽聽}

聽聽聽聽
public 聽String聽getServiceName()聽{
聽聽聽聽聽聽聽聽
return 聽serviceName;
聽聽聽聽}

聽聽聽聽
public void 聽setServiceName(String聽serviceName)聽{
聽聽聽聽聽聽聽聽
this .serviceName聽 = 聽serviceName;
聽聽聽聽}

聽聽聽聽
public 聽XmlRpcServletServer聽getXmlRpcServletServer()聽{
聽聽聽聽聽聽聽聽
return 聽server;
聽聽聽聽}
聽聽聽聽
聽聽聽聽
/* 聽(non-Javadoc)
聽聽聽聽聽*聽@see聽org.springframework.web.servlet.mvc.Controller#handleRequest(javax.servlet.http.HttpServletRequest,聽javax.servlet.http.HttpServletResponse)
聽聽聽聽聽
*/
聽聽聽聽
public 聽ModelAndView聽handleRequest(HttpServletRequest聽request,
聽聽聽聽聽聽聽聽聽聽聽聽HttpServletResponse聽response)聽
throws 聽Exception聽{
聽聽聽聽聽聽聽聽
if 聽( ! WebContentGenerator.METHOD_POST.equals(request.getMethod()))聽{
聽聽聽聽聽聽聽聽聽聽聽聽
throw new 聽ServletException( " XmlRpcServiceExporter聽only聽supports聽POST聽requests " );
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽server.execute(request,聽response);
聽聽聽聽聽聽聽聽
return null ;
聽聽聽聽}

聽聽聽聽
/* 聽(non-Javadoc)
聽聽聽聽聽*聽@see聽org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
聽聽聽聽聽
*/
聽聽聽聽
public void 聽afterPropertiesSet()聽 throws 聽Exception聽{
聽聽聽聽聽聽聽聽server聽
= new 聽XmlRpcServletServer();
聽聽聽聽聽聽聽聽server.setHandlerMapping(newXmlRpcHandlerMapping());
聽聽聽聽聽聽聽聽
if 聽(enabledForExtensions != null )聽{
聽聽聽聽聽聽聽聽聽聽聽聽((XmlRpcServerConfigImpl)聽server.getConfig()).setEnabledForExtensions(enabledForExtensions.booleanValue());
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
聽聽聽聽}

聽聽聽聽
/** 聽Creates聽a聽new聽handler聽mapping.聽The聽default聽implementation聽loads
聽聽聽聽聽*聽a聽property聽file聽from聽the聽resource
聽聽聽聽聽*聽
聽聽聽聽聽
*/
聽聽聽聽
protected 聽XmlRpcHandlerMapping聽newXmlRpcHandlerMapping()聽 throws 聽XmlRpcException聽{
聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽SpringHandlerMapping聽mapping聽
= new 聽SpringHandlerMapping(getServiceInterface());
聽聽聽聽聽聽聽聽mapping.addHandler(getServiceName(),聽getServiceInterface());
聽聽聽聽聽聽聽聽mapping.setTagetObject(getProxyForService());
聽聽聽聽聽聽聽聽
return 聽mapping;
聽聽聽聽}
聽聽聽聽
}

spring閰嶇疆鏂囦歡
聽聽聽聽<bean聽id="accountService"聽聽class="com.jdkcn.service.impl.AccountServiceImpl">
聽聽聽聽
</bean>
聽聽聽聽聽聽聽聽
<bean聽name="rpcAccountService"聽class="com.jdkcn.xmlrpc.XmlRpcServiceExporter">
聽聽聽聽聽聽聽聽
<property聽name="service">
聽聽聽聽聽聽聽聽聽聽聽聽
<ref聽bean="accountService"/>
聽聽聽聽聽聽聽聽
</property>
聽聽聽聽聽聽聽聽
<property聽name="serviceName">
聽聽聽聽聽聽聽聽聽聽聽聽
<value>jdkcn.accountService</value>
聽聽聽聽聽聽聽聽
</property>
聽聽聽聽聽聽聽聽
<property聽name="enabledForExtensions">
聽聽聽聽聽聽聽聽聽聽聽聽
<value>true</value>
聽聽聽聽聽聽聽聽
</property>
聽聽聽聽聽聽聽聽
<property聽name="serviceInterface">
聽聽聽聽聽聽聽聽聽聽聽聽
<value>com.jdkcn.service.AccountService</value>
聽聽聽聽聽聽聽聽
</property>
聽聽聽聽
</bean>
鐒跺悗鏄犲皠涓涓湴鍧灝卞彲浠ラ氳繃xmlrpc璁塊棶鏈嶅姟浜?br />
聽聽聽聽<bean聽id="urlMapping"聽class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
聽聽聽聽聽聽聽聽
<property聽name="mappings">
聽聽聽聽聽聽聽聽聽聽聽聽
<props>
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
<prop聽key="/account">rpcAccountService</prop>
聽聽聽聽聽聽聽聽聽聽聽聽
</props>
聽聽聽聽聽聽聽聽
</property>
聽聽聽聽
</bean>
web.xml
聽聽聽聽<context-param>
聽聽聽聽聽聽聽聽
<param-name>contextConfigLocation</param-name>
聽聽聽聽聽聽聽聽
<param-value>
聽聽聽聽聽聽聽聽聽聽聽聽classpath:spring/global.xml
聽聽聽聽聽聽聽聽
</param-value>
聽聽聽聽
</context-param>
聽聽聽聽
聽聽聽聽
<listener>
聽聽聽聽聽聽聽聽
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
聽聽聽聽
</listener>

聽聽聽聽聽聽聽聽
<servlet>
聽聽聽聽聽聽聽聽聽聽聽聽
<servlet-name>service</servlet-name>
聽聽聽聽聽聽聽聽聽聽聽聽
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
聽聽聽聽聽聽聽聽
</servlet>

聽聽聽聽聽聽聽聽
<servlet-mapping>
聽聽聽聽聽聽聽聽聽聽聽聽
<servlet-name>service</servlet-name>
聽聽聽聽聽聽聽聽聽聽聽聽
<url-pattern>/service/xmlrpc3/*</url-pattern>
聽聽聽聽聽聽聽聽
</servlet-mapping>
鐒跺悗鎴戜滑鐨剆ervice鍦板潃灝辨槸榪欐牱鐨刪ttp://localhost:8080/service/xmlrpc3/account

甯屾湜瀵瑰ぇ瀹舵湁鐢紝榪欓噷鎻愪緵project涓嬭澆銆傚寘鍚竴涓猚lient紼嬪簭銆俢om.jdkcn.xmlrpc.Client

鐐瑰嚮涓嬭澆瀹屾暣浠g爜

鍒涢犲叡鐢ㄥ崗璁?緗插悕,闈炲晢涓?淇濇寔涓鑷? src=聽聽 闄ょ粡鐗瑰埆娉ㄦ槑澶?鏈枃绔犵増鏉冨綊鑾娉℃場鎵鏈?
緗插悕,闈炲晢涓氱敤閫?淇濇寔涓鑷?聽聽聽somebody(鑾)

鑾 2006-10-22 16:12 鍙戣〃璇勮
]]>
鍏充簬Hibernate3鐨別scape瑙e喅鏂規硶http://m.tkk7.com/rory/archive/2006/10/16/hibernate3_escape.html鑾鑾Mon, 16 Oct 2006 15:29:00 GMThttp://m.tkk7.com/rory/archive/2006/10/16/hibernate3_escape.htmlhttp://m.tkk7.com/rory/comments/75503.htmlhttp://m.tkk7.com/rory/archive/2006/10/16/hibernate3_escape.html#Feedback1http://m.tkk7.com/rory/comments/commentRss/75503.htmlhttp://m.tkk7.com/rory/services/trackbacks/75503.html
SELECT*FROM聽t_user聽where聽nickname聽like'%Goo\_D'escape'\'
榪欓噷瀵筥榪涜杞箟浜嗐傚洜涓虹敤鎴鋒樀縐板寘鍚笅鍒掔嚎錛屽鏋滀笉榪涜杞箟灝辮〃紺轟竴涓換鎰忓瓧絎︺傛湁鏃跺欐垜浠彲鑳借繕闇瑕佸%榪涜杞箟銆傚悓鏍風殑鏂規硶鍦?鍓嶅姞\% 浣嗘槸姣旇搗鏅氱殑like璇彞銆傚浜嗕竴涓0鏄庤漿涔夌鐨勮鍙ャ傛墍浠ユ垜浠細鎯沖埌榪欐牱鐨勮鍙?br />
DetachedCriteria聽criteria聽=聽DetachedCriteria.forClass(User.class);
criteria.add(Restrictions.like(
"nickname",聽user.getNickname()+"'聽escape'\"));
浣嗘槸榪欐牱鏄笉綆$敤鐨勩?br />鎺ヤ笅鏉ュ彲鑳戒細鎯沖埌浣跨敤Hibernate3鐨勫師鐢焥ql鏌ヨ錛屽叾瀹炴垜浠笉闇瑕佽繖鏍峰仛銆傛垜浠繕鏄嬌鐢–riteria鏉′歡鏌ヨ銆?br />
criteria.add(Restrictions.sqlRestriction("{alias}.nickname聽like聽?聽escape'/'",聽StringUtil.escapeSQLLike(user.getNickname()),聽Hibernate.STRING));
榪欐牱Hibernate浜х敓鐨勮鍙ュ氨鏄垜浠兂瑕佺殑璇彞浜嗐?br />
聽聽聽聽/**
聽聽聽聽聽*聽杞箟like璇彞涓殑
聽聽聽聽聽*聽<code>'_'</code><code>'%'</code>
聽聽聽聽聽*聽灝?lt;code>'?'</code>杞垚sql鐨?lt;code>'/_'</code>
聽聽聽聽聽*聽灝?lt;code>'%'</code>杞垚sql鐨?lt;code>'/%'</code>
聽聽聽聽聽*聽<p>
聽聽聽聽聽*聽聽聽渚嬪鎼滅儲<code>?aa*bb?c_d%f</code>灝嗚漿鍖栨垚<br/>
聽聽聽聽聽*聽聽聽<code>_aa%bb_c/_d/%f</code>
聽聽聽聽聽*聽</p>
聽聽聽聽聽*聽
@param聽likeStr
聽聽聽聽聽*聽
@return
聽聽聽聽聽*聽
@author聽<a聽href="http://jdkcn.com">somebody</a>
聽聽聽聽聽
*/
聽聽聽聽
publicstatic聽String聽escapeSQLLike(String聽likeStr)聽{
聽聽聽聽聽聽聽聽String聽str聽
=聽StringUtils.replace(likeStr,聽"_",聽"/_");
聽聽聽聽聽聽聽聽str聽
=聽StringUtils.replace(str,聽"%",聽聽聽聽"/%");
聽聽聽聽聽聽聽聽str聽
=聽StringUtils.replace(str,聽"?",聽"_");
聽聽聽聽聽聽聽聽str聽
=聽StringUtils.replace(str,聽"*",聽"%");
聽聽聽聽聽聽聽聽
return聽str;
聽聽聽聽}

鍒涢犲叡鐢ㄥ崗璁?緗插悕,闈炲晢涓?淇濇寔涓鑷? src=聽聽 闄ょ粡鐗瑰埆娉ㄦ槑澶?鏈枃绔犵増鏉冨綊鑾娉℃場鎵鏈?
緗插悕,闈炲晢涓氱敤閫?淇濇寔涓鑷?聽聽聽somebody(鑾)

鑾 2006-10-16 23:29 鍙戣〃璇勮
]]>
鍏充簬spring鍚姩鐨勪紭鍖栫殑闂http://m.tkk7.com/rory/archive/2006/08/10/speed_up_spring_problem.html鑾鑾Thu, 10 Aug 2006 02:59:00 GMThttp://m.tkk7.com/rory/archive/2006/08/10/speed_up_spring_problem.htmlhttp://m.tkk7.com/rory/comments/62740.htmlhttp://m.tkk7.com/rory/archive/2006/08/10/speed_up_spring_problem.html#Feedback2http://m.tkk7.com/rory/comments/commentRss/62740.htmlhttp://m.tkk7.com/rory/services/trackbacks/62740.htmljspark 鐨勮繖綃囨枃绔犮?a class="postTitle2" id="viewpost1_TitleUrl" href="/jspark/archive/2006/07/29/60712.html">寮鍙戦樁孌礶clipse涓嬮潰鐨剆pring瀹瑰櫒鐨勫惎鍔ㄤ紭鍖?/a> 銆嬭鍒板浣曞姞蹇玸pring鐨勫惎鍔ㄩ熷害銆傞潪甯告劅璋?span style="FONT-WEIGHT: bold">jspark. 涓涓嬫槸寮曠敤鐨勫師鏂囷細

鏈榪戝湪璐熻矗涓涓ぇ欏圭洰錛岄」鐩粍鎴愬憳鍖呮嫭欏圭洰緇忕悊澶ф10涓漢宸﹀彸銆傞」鐩妧鏈敤struts+spring+hibernate瀹炵幇銆傞」鐩殑瑙勬ā鐩稿鏉ヨ鏄瘮杈冨ぇ鐨勶紝鎬誨叡鏈?0澶фā鍧楋紝姣忎釜澶фā鍧楀張鍒嗕負鏈夊崄鍑犱釜銆佺敋鑷沖嚑鍗佷釜灝忔ā鍧椼傚紑鍙戝伐鍏風敤eclipse錛岀敱浜庡湪寮鍙戦樁孌碉紝欏圭洰寮鍙戞垚鍛橀渶瑕侀綣侀噸鍚湇鍔″櫒銆傚湪鍚姩鏈嶅姟鍣ㄧ殑鏃跺欙紝姣忔鍚姩鏃墮棿鎬繪槸浼氳秴榪?鍒嗛挓銆傝寰椾互鍓嶅湪鍋氬彟澶栦竴涓」鐩椂錛屽惎鍔ㄦ椂闂翠笉鍒?縐掗挓錛岀浉宸簡10鍊嶏紝鑰屼笖欏圭洰瑙勬ā鏄樊涓嶅鐨勩?/span>

聽聽聽 浠庡垵姝ュ垎鏋愭潵璇達紝搴旇鏄痟ibernate瑙i噴hbm.xml鏃惰姳璐規椂闂達紝鎴栬呭彲鑳芥槸spring瀹瑰櫒鍚姩騫惰В閲婃墍鏈夌殑bean閰嶇疆鏂囦歡銆傝瘖鏂簡涓涓嬶紝鍙戠幇1鍒嗛挓娑堣楃殑鏃墮棿涓昏鍒嗗竷鍦╤ibernate瑙i噴hbm.xml鑺辮垂5縐掞紱spring瀹瑰櫒浠庡惎鍔ㄥ埌瑙i噴bean閰嶇疆鏂囦歡绔熺劧鑺變簡58縐掞紝鐪熸槸澶殻寮犱簡銆傚綋鏃墮潪甯告鐤憇pring鐨勬晥鐜囬棶棰樸備紒鍥句粠緗戜笂鎼滅儲鐩稿叧璧勬枡錛岀湅鐪嬫湁浠涔堜紭鍖栨帾鏂姐?/span>

聽聽聽 棣栧厛鏄壘鍒頒簡hibernate鐨勫惎鍔ㄤ紭鍖?http://www.hibernate.org/194.html聽 閲岄潰鐨勪富瑕佹濇兂鏄氳繃灝唜ml搴忓垪鑺卞埌鏈湴鐨勬枃浠墮噷錛屾瘡嬈¤鍙栫殑鏃跺欐牴鎹儏鍐碉紝浠庢湰鍦版枃浠惰鍙栧茍鍙嶅簭鍒楀寲錛岃妭鐪佷簡hibernate xml鐨勮В鏋愭椂闂淬傛寜鐓ц繖涓柟寮忔祴璇曚簡涓涓嬶紝鍙戠幇hibernate鐨勫惎鍔ㄦ椂闂翠粠5縐掗檷浣庡埌3縐掞紝浣嗘槸榪欎釜浼樺寲瀵逛簬鏁翠釜鍚姩榪囩▼鏄澂姘磋濺钖殑錛屾鏃犵敤澶勩?/span>

聽聽聽 娌″姙娉曪紝鍙堜粩緇嗘煡鐪嬩簡spring鐨勮祫鏂欙紝緇堜簬鍙戠幇spring鐨勫鍣ㄦ槸鎻愪緵浜唋azy-load鐨勶紝鍗抽粯璁ょ殑緙虹渷璁劇疆鏄痓ean娌℃湁lazy- load錛岃灞炴у浜巉alse鐘舵侊紝榪欐牱瀵艱嚧spring鍦ㄥ惎鍔ㄨ繃紼嬪鑷村湪鍚姩鏃跺欙紝浼氶粯璁ゅ姞杞芥暣涓璞″疄渚嬪浘錛屼粠鍒濆鍖朅CTION閰嶇疆銆佸埌 service閰嶇疆鍒癲ao閰嶇疆銆佷箖鑷沖埌鏁版嵁搴撹繛鎺ャ佷簨鍔$瓑絳夈傝繖涔堝簽澶х殑瑙勬ā錛岄毦鎬猻pring鐨勫惎鍔ㄦ椂闂磋鑺卞皢榪?鍒嗛挓銆傚皾璇曚簡涓涓嬶紝鎶奲eans鐨?default-lazy-init鏀逛負true灝憋紝鍐嶆鍚姩錛岄熷害浠庡師鏉ョ殑55縐掞紝闄嶅埌8縐掗挓錛侊紒Great錛佽櫧鐒舵槸闈炲父灝忎竴涓敼鍔紝浣嗘槸褰卞搷紜疄闈炲父澶с備竴涓」鐩粍10涓漢錛屽亣鑻ユ瘡涓漢涓澶╁鉤鍧囬渶瑕佸湪eclipse涓嬪惎鍔ㄦ祴璇曟湇鍔″櫒50嬈°傞偅涔堜竴澶╅」鐩粍闇瑕侀噸鍚?00嬈★紝姣忔鑺傜渷50縐掔殑璇濓紝灝辨槸 25000縐掞紝灝嗚繎鍑犱釜灝忔椂錛屽樊涓嶅涓涓伐浣滄棩錛屽涔堝彲瑙傜殑鏁板瓧錛?/span>

聽聽 涓嶈繃鍦ㄨ繍琛屾湡闂寸涓嬈$偣欏甸潰鐨勬椂鍊欙紝鐢變簬spring鍋氫簡lazy-load錛岀幇鍦ㄥ氨闇瑕佸惎鍔ㄤ竴閮ㄥ垎闇瑕佺殑beans錛屾墍浠ョ◢寰參2錛?縐掗挓錛屼絾鏄槑鏄炬瘮絳夊嚑鍗佺瑕佸揩寰堝錛屽煎緱涓閴淬?/span>

聽聽聽 浠ヤ笂鏄拡瀵瑰紑鍙戦樁孌電殑spring瀹瑰櫒鍚姩浼樺寲錛屽湪閮ㄧ講鍒板疄闄呯幆澧冧腑錛屽掓槸娌″繀瑕佽緗負lazy-load銆傛瘯绔熼儴緗插埌瀹為檯鐜涓笉鏄粡甯哥殑浜嬶紝姣忔鍚姩1鍒嗛挓鍊掍笉鏄ぇ闂銆?

鎴戣繖閲岃鎻愰啋鐨勬槸涓嶆槸璇存湁鐨刡eans閮借兘璁劇疆default-lazy-init鎴愪負true.瀵逛簬scheduler鐨刡ean涓嶈兘鐢╨azy-init

< beans聽 default-lazy-init ="true" >
聽聽聽聽
聽聽聽聽
< bean聽 class ="org.springframework.scheduling.quartz.SchedulerFactoryBean" >
聽聽聽聽聽聽聽聽
< property聽 name ="triggers" >
聽聽聽聽聽聽聽聽聽聽聽聽
< list >
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="buildHtmlTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="askTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="mailSenderTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="topicDetailBuildTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="forumBuildTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="topicBuildTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽
</ list >
聽聽聽聽聽聽聽聽
</ property >
聽聽聽聽
</ bean >
</ beans >




榪欐牱鐨勮瘽銆傛墍鏈夌殑scheduler灝遍兘涓嶇鐢ㄤ簡銆傛墍浠ヨ澶у瑕佹敞鎰忋?br />

< beans >
聽聽聽聽
聽聽聽聽
< bean聽 class ="org.springframework.scheduling.quartz.SchedulerFactoryBean" >
聽聽聽聽聽聽聽聽
< property聽 name ="triggers" >
聽聽聽聽聽聽聽聽聽聽聽聽
< list >
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="buildHtmlTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="askTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="mailSenderTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="topicDetailBuildTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="forumBuildTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
< ref聽 bean ="topicBuildTrigger" />
聽聽聽聽聽聽聽聽聽聽聽聽
</ list >
聽聽聽聽聽聽聽聽
</ property >
聽聽聽聽
</ bean >
</ beans >




鑾 2006-08-10 10:59 鍙戣〃璇勮
]]>
榪樻槸涔辯爜闂http://m.tkk7.com/rory/archive/2006/07/22/59567.html鑾鑾Sat, 22 Jul 2006 10:13:00 GMThttp://m.tkk7.com/rory/archive/2006/07/22/59567.htmlhttp://m.tkk7.com/rory/comments/59567.htmlhttp://m.tkk7.com/rory/archive/2006/07/22/59567.html#Feedback4http://m.tkk7.com/rory/comments/commentRss/59567.htmlhttp://m.tkk7.com/rory/services/trackbacks/59567.html聽聽聽聽 铏界劧欏圭洰鍏ㄩ儴閲囩敤浜哢TF-8緙栫爜錛屾墍鏈夌殑婧愭枃浠?.java,*.jsc,*.html,*.ftl閮介噰鐢ㄤ簡UTF-8緙栫爜銆傚彲鏄繕鏄嚭鐜頒簡涔辯爜闂銆傚緢鏄笉鐖斤紝鍚庢潵鎵懼埌浜唗omcat錛屽拰resin鐨勯厤緗?/p>
  1. Tomcat鐨勯厤緗?conf/server.xml)
    聽聽聽聽<!--聽Define聽a聽non-SSL聽HTTP/1.1聽Connector聽on聽port聽8080聽-->
    聽聽聽聽
    <Connector聽port="80"聽maxHttpHeaderSize="8192"
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽maxThreads
    ="150"聽minSpareThreads="25"聽maxSpareThreads="75"
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽enableLookups
    ="false"聽redirectPort="8443"聽acceptCount="100"
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽connectionTimeout
    ="20000"聽disableUploadTimeout="true"聽URIEncoding="UTF-8"/>
  2. Resin鐨勯厤緗?conf/resin.conf)

    character-encoding

    Resin 1.1
    child of: resin, server, host-default, host, web-app-default, web-app
    default: The default value is ISO-8859-1.

    Specifies the default character encoding for the environment.

    <web-app id='/'>
      <character-encoding>shift_jis</character-encoding>
      ...
    
    </web-app>
    

聽聽聽聽 榪欎釜鏄痳esin doc閲岄潰鐨勬垜鏄湪web-app-default閲岄潰鍔犱笂浜唀ncoding鐨勯厤緗?/p>

聽聽聽聽 < web-app-default >
聽聽聽聽聽聽
< character-encoding > UTF-8 </ character-encoding >
聽聽聽聽聽聽
聽聽聽聽
</ web-app-default >

甯屾湜瀵逛綘鐨勯」鐩湁甯姪銆?/p>

鍒涢犲叡鐢ㄥ崗璁?緗插悕,闈炲晢涓?淇濇寔涓鑷? src= 聽聽 闄ょ粡鐗瑰埆娉ㄦ槑澶?鏈枃绔犵増鏉冨綊鑾娉℃場鎵鏈?
緗插悕,闈炲晢涓氱敤閫?淇濇寔涓鑷?聽聽聽somebody(鑾)聽聽



鑾 2006-07-22 18:13 鍙戣〃璇勮
]]>
鍏充簬Resin铏氭嫙鐩綍閰嶇疆鐨勯棶棰?/title><link>http://m.tkk7.com/rory/archive/2006/07/18/58838.html</link><dc:creator>鑾</dc:creator><author>鑾</author><pubDate>Tue, 18 Jul 2006 11:41:00 GMT</pubDate><guid>http://m.tkk7.com/rory/archive/2006/07/18/58838.html</guid><wfw:comment>http://m.tkk7.com/rory/comments/58838.html</wfw:comment><comments>http://m.tkk7.com/rory/archive/2006/07/18/58838.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/rory/comments/commentRss/58838.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/rory/services/trackbacks/58838.html</trackback:ping><description><![CDATA[欏圭洰涓涓」鐩渶瑕佸悓鏃跺紩鐢ㄤ竴涓潤鎬佽祫婧愶紝鎵浠ュ氨鎯沖埌閰嶇疆涓嶅悓鐨勮櫄鎷熺洰褰曟寚鍒板悓涓涓洰褰曘備簬鏄湁涓嬮潰鐨勯厤緗?<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">聽聽聽聽</span><span style="COLOR: #008000"><!--</span><span style="COLOR: #008000">聽configures聽the聽default聽host,聽matching聽any聽host聽name聽</span><span style="COLOR: #008000">--></span><span style="COLOR: #000000"><br />聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">host聽</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">=""</span><span style="COLOR: #ff0000">聽root-directory</span><span style="COLOR: #0000ff">="."</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br />聽聽聽聽聽聽</span><span style="COLOR: #008000"><!--</span><span style="COLOR: #008000"><br />聽聽聽聽聽聽聽聽聽-聽configures聽an聽explicit聽root聽web-app聽matching聽the<br />聽聽聽聽聽聽聽聽聽-聽webapp's聽ROOT<br />聽聽聽聽聽聽聽聽</span><span style="COLOR: #008000">--></span><span style="COLOR: #000000"><br />聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">web-app聽</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="/"</span><span style="COLOR: #ff0000">聽document-directory</span><span style="COLOR: #0000ff">="webapps/ROOT"</span><span style="COLOR: #0000ff">/></span><span style="COLOR: #000000"><br />聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">web-app聽</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="/community/jsvm2"</span><span style="COLOR: #ff0000">聽document-directory</span><span style="COLOR: #0000ff">="D:\\projects\\FelooComponents\\jsvm2"</span><span style="COLOR: #0000ff">/></span><span style="COLOR: #000000"><br />聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">web-app聽</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="/passport/jsvm2"</span><span style="COLOR: #ff0000">聽document-directory</span><span style="COLOR: #0000ff">="D:\\projects\\FelooComponents\\jsvm2"</span><span style="COLOR: #0000ff">/></span><span style="COLOR: #000000"><br />聽聽聽聽</span><span style="COLOR: #0000ff"></</span><span style="COLOR: #800000">host</span><span style="COLOR: #0000ff">></span></div><p>聽聽聽聽聽聽 浣嗘槸鍙戠幇榪欐牱鍙湁鍚庨潰涓涓鐢?<a href="http://localhost:8080/passport/jsvm2">http://localhost:8080/passport/jsvm2</a>)榪欎釜鏄彲浠?鍙槸(<a href="http://localhost:8080/community/jsvm2">http://localhost:8080/community/jsvm2</a>)灝變笉琛?寰堟槸閮侀椃銆傚彧瑕佸悗闈㈢殑document-directory涓嶆槸鍚屼竴涓洰褰曞氨鎴愩?br />聽聽聽聽聽聽 鍚庢潵鍦╮esin鐨刣oc閲岄潰鐪嬪埌path鐨勯厤緗?/p><h4>path-mapping</h4><div id="meoi6ey" class="desc"><b>child of:</b> web-app-default, web-app<br /><p>Maps url patterns to real paths. If using a server like IIS, you may need to match the server's path aliases.</p><p></p><table class="deftable" cellspacing="0" cellpadding="2" width="90%" border="1"><tbody><tr><th>Attribute</th><th>Meaning</th><th>default</th></tr><tr><td><span id="24eyo84" class="meta">url-pattern</span></td><td>A pattern matching the url: <span id="uauckwy" class="meta">/foo/*</span>, <span id="k6c2am8" class="meta">/foo</span>, or <span id="8m4koqq" class="meta">*.foo</span></td></tr><tr><td>url-regexp</td><td>A regular expression matching the url </td></tr><tr><td>real-path</td><td>The prefix of the real path. When used with <span id="eakucwo" class="meta">url-regexp</span>, allows substitution variables like <span id="iwyscuc" class="meta">$1</span>. </td></tr></tbody></table><p></p><table class="egpad" cellspacing="0" width="90%"><tbody><tr><td class="example" bgcolor="#ffeecc"><pre><web-app id='/'> <path-mapping url-pattern='/resin/*' real-path='e:\resin'/> <path-mapping url-regexp='/~([^/]*)' real-path='e:\home$1'/> </web-app> </pre></td></tr></tbody></table></div><p>鏀規榪欐牱鐨勯厤緗氨ok浜嗐?/p><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000">聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">web-app聽</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="/community"</span><span style="COLOR: #ff0000">聽document-directory</span><span style="COLOR: #0000ff">="D:\\projects\\FelooCommunityWeb"</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br />聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">path-mapping聽</span><span style="COLOR: #ff0000">url-pattern</span><span style="COLOR: #0000ff">='jsvm2/*'<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #ff0000">real-path</span><span style="COLOR: #0000ff">='D:\\projects\\FelooComponents\\jsvm2'/><br />聽聽聽聽聽聽</span><span style="COLOR: #ff0000"></web-app</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br />聽聽聽聽聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">web-app聽</span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="/passport"</span><span style="COLOR: #ff0000">聽document-directory</span><span style="COLOR: #0000ff">="D:\\projects\\FelooPassportWeb"</span><span style="COLOR: #0000ff">></span><span style="COLOR: #000000"><br />聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #0000ff"><</span><span style="COLOR: #800000">path-mapping聽</span><span style="COLOR: #ff0000">url-pattern</span><span style="COLOR: #0000ff">='jsvm2/*'<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽</span><span style="COLOR: #ff0000">real-path</span><span style="COLOR: #0000ff">='D:\\projects\\FelooComponents\\jsvm2'/><br />聽聽聽聽聽聽</span><span style="COLOR: #ff0000"></web-app</span><span style="COLOR: #0000ff">></span></div><a target="_blank"><img height="31" alt="鍒涢犲叡鐢ㄥ崗璁?緗插悕,闈炲晢涓?淇濇寔涓鑷? src="http://leaf.jdk.cn/rights.gif" width="88" border="0" /></a>聽聽 闄ょ粡鐗瑰埆娉ㄦ槑澶?鏈枃绔犵増鏉冨綊<strong><a class="" title="" target=""><font color="#6b6b52">鑾娉℃場</font></a></strong>鎵鏈? <br /><font color="#ff0000">緗插悕,闈炲晢涓氱敤閫?淇濇寔涓鑷?</font>聽聽聽somebody(鑾)<img src ="http://m.tkk7.com/rory/aggbug/58838.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/rory/" target="_blank">鑾</a> 2006-07-18 19:41 <a href="http://m.tkk7.com/rory/archive/2006/07/18/58838.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏充簬DWR2.0鐨勯厤緗棶棰?/title><link>http://m.tkk7.com/rory/archive/2006/07/17/58484.html</link><dc:creator>鑾</dc:creator><author>鑾</author><pubDate>Sun, 16 Jul 2006 18:11:00 GMT</pubDate><guid>http://m.tkk7.com/rory/archive/2006/07/17/58484.html</guid><wfw:comment>http://m.tkk7.com/rory/comments/58484.html</wfw:comment><comments>http://m.tkk7.com/rory/archive/2006/07/17/58484.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/rory/comments/commentRss/58484.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/rory/services/trackbacks/58484.html</trackback:ping><description><![CDATA[<p>鑷粠鎹㈠伐浣滀箣鍚庡氨娌℃湁鐮旂┒榪嘍WR浜嗐備笅杞戒簡鏈鏂扮殑DWR2.0M2鐗堟湰銆?.0鍔犱簡寰堝涓滆タ錛屼篃鏈変笉灝戝彉鍖栫殑鍦版柟銆傛渶瀹規槗鐪嬪埌鐨勫彉鍖栧氨鏄寘鍚嶇殑鍙樺寲浜?鐢?<strong>uk.ltd.getahead </strong>鍙樻垚浜?<strong>org.directwebremoting </strong>銆?br />聽聽聽聽聽聽 聽鎹笂浜嗘柊鐨勯厤緗?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <span style="COLOR: #000000">聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">servlet</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">servlet-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">dwr-invoker</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">servlet-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">servlet-class</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">org.directwebremoting.servlet.DwrServlet</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">servlet-class</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">init-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">debug</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">true</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">init-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">load-on-startup</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">1</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">load-on-startup</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">servlet</span> <span style="COLOR: #0000ff">></span> </div> <p>鍚姩鏈嶅姟錛屾姳閿欎簡銆?/p> <p>java.lang.IllegalArgumentExcep<wbr></wbr>tion: DefaultContainer can't find a classes<br />聽 聽 聽 聽at org.directwebremoting.impl<wbr></wbr>.DefaultContainer.getBean(DefaultContainer.java:216)<br />聽 聽 聽 聽at org.directwebremoting.annotati<wbr></wbr>ons.AnnotationsConfigurator<wbr></wbr>.configure(AnnotationsConfigurator.java:50)<br />聽 聽 聽 聽at org.directwebremoting.servlet<wbr></wbr>.DwrServlet.init(DwrServlet.java:121)</p> <p>聽聽聽聽聽 鍦―WR鐨凪aillist閲岄潰鎼滅儲浜嗕竴涓嬶紝榪樻湁絳旀錛屽師鏉WR2.0 鍔犲叆浜咼DK5鐨勬敞閲?<span id="cgggsss" class="st" id="st" name="st">annotations</span>).DwrServlet鍒濆鍖栫殑鏃跺欎細鍘繪鏌ユ敞閲婄殑綾伙紝鎵句笉鍒板氨鎶遍敊浜嗐傚鏋滀綘涓嶇敤annotations涔熷彲浠ュ拷鐣ユ帀榪欎釜閿欒銆備笉榪囩湅璧鋒潵鎬繪槸涓嶇埥銆傛湁浜烘彁鍑轟簡鏂規銆傝繖鏍峰氨ok浜嗐?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <span style="COLOR: #000000">聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">servlet</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">servlet-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">dwr-invoker</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">servlet-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">servlet-class</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">org.directwebremoting.servlet.DwrServlet</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">servlet-class</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">init-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">debug</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">true</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">init-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">init-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">classes</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-name</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">java.lang.Object</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">param-value</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">init-param</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">load-on-startup</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">100</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">load-on-startup</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br />聽聽聽聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">servlet</span> <span style="COLOR: #0000ff">></span> </div> <p> <a target="_blank"> <img height="31" alt="鍒涢犲叡鐢ㄥ崗璁?緗插悕,闈炲晢涓?淇濇寔涓鑷? src="http://leaf.jdk.cn/rights.gif" width="88" border="0" /> </a>聽聽 闄ょ粡鐗瑰埆娉ㄦ槑澶?鏈枃绔犵増鏉冨綊<strong><a class="" title="" target=""><font color="#6b6b52">鑾娉℃場</font></a></strong>鎵鏈? <br /><font color="#ff0000">緗插悕,闈炲晢涓氱敤閫?淇濇寔涓鑷?</font>聽聽聽somebody(鑾)聽聽 </p><img src ="http://m.tkk7.com/rory/aggbug/58484.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/rory/" target="_blank">鑾</a> 2006-07-17 02:11 <a href="http://m.tkk7.com/rory/archive/2006/07/17/58484.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏充簬Freemarker鐢熸垚闈欐佹枃浠剁殑闂http://m.tkk7.com/rory/archive/2006/06/21/54134.html鑾鑾Wed, 21 Jun 2006 02:46:00 GMThttp://m.tkk7.com/rory/archive/2006/06/21/54134.htmlhttp://m.tkk7.com/rory/comments/54134.htmlhttp://m.tkk7.com/rory/archive/2006/06/21/54134.html#Feedback0http://m.tkk7.com/rory/comments/commentRss/54134.htmlhttp://m.tkk7.com/rory/services/trackbacks/54134.html浣跨敤FreeMarker鐢熸垚Html闈欐佹枃浠?瀹炰緥)銆?br />聽聽聽聽聽 鍦ㄦ垜浠殑欏圭洰涓篃鐢ㄥ埌浜咶reemarker鐢熸垚闈欐佹枃浠躲備笉榪囪繖閲屾垜瑕佽鐨勬槸緙栫爜鐨勯棶棰樸傛垜浠殑欏圭洰浣跨敤鐨勯兘鏄疷TF-8緙栫爜錛屾垜鐩存帴浣跨敤 椋炰簯灝忎緺 鎻愪緵鐨勬柟娉曠敓鎴愮殑鏂囦歡鍦║TF-8緙栫爜涓嬪療鐪嬫槸涔辯爜錛岃孏BK姝e父(鍚庢潵鍙戠幇鍥犱負鎴戠敤鐨勪腑鏂囨搷浣滅郴緇熸墍浠ョ敤GBK鏌ョ湅姝e父)銆?br />聽聽聽聽聽 褰撶劧鎴戞妸Freemarker鐨勯厤緗兘鏀規垚浜哢TF-8錛屾垜鐨勬ā鐗堟枃浠朵篃鏄疷TF-8緙栫爜鐨勩備笅闈㈡槸鍘熸潵鐨勪唬鐮?br />
聽聽聽聽publicvoid聽setTemplatePath(Resource聽templatePath)聽{
聽聽聽聽聽聽聽聽
this.templatePath聽=聽templatePath;
聽聽聽聽聽聽聽聽
//璁劇疆freemarker鐨勫弬鏁?/span>
聽聽聽聽聽聽聽聽freemarkerCfg聽=new聽Configuration();
聽聽聽聽聽聽聽聽
try聽{
聽聽聽聽聽聽聽聽聽聽聽聽freemarkerCfg.setDirectoryForTemplateLoading(
this.templatePath.getFile());
聽聽聽聽聽聽聽聽聽聽聽聽freemarkerCfg.setObjectWrapper(
new聽DefaultObjectWrapper());
聽聽聽聽聽聽聽聽聽聽聽聽freemarkerCfg.setDefaultEncoding(
"UTF-8");
聽聽聽聽聽聽聽聽}聽
catch聽(IOException聽ex)聽{
聽聽聽聽聽聽聽聽聽聽聽聽
thrownew聽SystemException("No聽Directory聽found,please聽check聽you聽config.");
聽聽聽聽聽聽聽聽}
聽聽聽聽}
聽聽聽聽/**
聽聽聽聽聽*聽鐢熸垚闈欐佹枃浠?br />聽聽聽聽聽*聽
@param聽templateFileName聽妯$増鍚嶇Оeg:(biz/order.ftl)
聽聽聽聽聽*聽
@param聽propMap聽鐢ㄤ簬澶勭悊妯℃澘鐨勫睘鎬bject鏄犲皠聽
聽聽聽聽聽*聽
@param聽htmlFilePath聽瑕佺敓鎴愮殑闈欐佹枃浠剁殑璺緞,鐩稿璁劇疆涓殑鏍硅礬寰?渚嬪聽"/biz/2006/5/"聽
聽聽聽聽聽*聽
@param聽htmlFileName聽瑕佺敓鎴愮殑鏂囦歡鍚?渚嬪聽"123.htm"聽
聽聽聽聽聽*聽
@return
聽聽聽聽聽
*/
聽聽聽聽
privateboolean聽buildHtml(String聽templateFileName,Map聽propMap,聽String聽htmlFilePath,String聽htmlFileName){
聽聽聽聽聽聽聽聽
try聽{
聽聽聽聽聽聽聽聽聽聽聽聽Template聽template聽
=聽freemarkerCfg.getTemplate(templateFileName);
聽聽聽聽聽聽聽聽聽聽聽聽template.setEncoding(
"UTF-8");
聽聽聽聽聽聽聽聽聽聽聽聽
//鍒涘緩鐢熸垚鏂囦歡鐩綍
聽聽聽聽聽聽聽聽聽聽聽聽creatDirs(buildPath.getFilename(),htmlFilePath);
聽聽聽聽聽聽聽聽聽聽聽聽File聽htmlFile聽
=new聽File(buildPath聽+聽htmlFilePath聽+聽htmlFileName);
聽聽聽聽聽聽聽聽聽聽聽聽Writer聽out聽
=new聽BufferedWriter(new聽OutputStreamWriter(new聽FileOutputStream(htmlFile)));
聽聽聽聽聽聽聽聽聽聽聽聽template.process(propMap,out);
聽聽聽聽聽聽聽聽聽聽聽聽out.flush();
聽聽聽聽聽聽聽聽聽聽聽聽
returntrue;
聽聽聽聽聽聽聽聽}聽
catch聽(TemplateException聽ex){
聽聽聽聽聽聽聽聽聽聽聽聽log.error(
"Build聽Error"+templateFileName,ex);
聽聽聽聽聽聽聽聽聽聽聽聽
returnfalse;
聽聽聽聽聽聽聽聽}聽
catch聽(IOException聽e)聽{
聽聽聽聽聽聽聽聽聽聽聽聽log.error(
"Build聽Error"+templateFileName,e);
聽聽聽聽聽聽聽聽聽聽聽聽
returnfalse;
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
聽聽聽聽}
涓嬮潰鏄慨鏀逛箣鍚庣殑浠g爜
聽聽聽聽/**
聽聽聽聽聽*聽鐢熸垚闈欐佹枃浠?br />聽聽聽聽聽*聽
@param聽templateFileName聽妯$増鍚嶇Оeg:(biz/order.ftl)
聽聽聽聽聽*聽
@param聽propMap聽鐢ㄤ簬澶勭悊妯℃澘鐨勫睘鎬bject鏄犲皠聽
聽聽聽聽聽*聽
@param聽htmlFilePath聽瑕佺敓鎴愮殑闈欐佹枃浠剁殑璺緞,鐩稿璁劇疆涓殑鏍硅礬寰?渚嬪聽"/biz/2006/5/"聽
聽聽聽聽聽*聽
@param聽htmlFileName聽瑕佺敓鎴愮殑鏂囦歡鍚?渚嬪聽"123.htm"聽
聽聽聽聽聽*聽
@return
聽聽聽聽聽
*/
聽聽聽聽
privateboolean聽buildHtml(String聽templateFileName,Map聽propMap,聽String聽htmlFilePath,String聽htmlFileName){
聽聽聽聽聽聽聽聽
try聽{
聽聽聽聽聽聽聽聽聽聽聽聽Template聽template聽
=聽freemarkerCfg.getTemplate(templateFileName);
聽聽聽聽聽聽聽聽聽聽聽聽template.setEncoding(
"UTF-8");
聽聽聽聽聽聽聽聽聽聽聽聽
//鍒涘緩鐢熸垚鏂囦歡鐩綍
聽聽聽聽聽聽聽聽聽聽聽聽creatDirs(buildPath.getFilename(),htmlFilePath);
聽聽聽聽聽聽聽聽聽聽聽聽File聽htmlFile聽
=new聽File(buildPath聽+聽htmlFilePath聽+聽htmlFileName);
聽聽聽聽聽聽聽聽聽聽聽聽Writer聽out聽
=new聽BufferedWriter(new聽OutputStreamWriter(new聽FileOutputStream(htmlFile),"UTF-8"));
聽聽聽聽聽聽聽聽聽聽聽聽template.process(propMap,out);
聽聽聽聽聽聽聽聽聽聽聽聽out.flush();
聽聽聽聽聽聽聽聽聽聽聽聽
returntrue;
聽聽聽聽聽聽聽聽}聽
catch聽(TemplateException聽ex){
聽聽聽聽聽聽聽聽聽聽聽聽log.error(
"Build聽Error"+templateFileName,ex);
聽聽聽聽聽聽聽聽聽聽聽聽
returnfalse;
聽聽聽聽聽聽聽聽}聽
catch聽(IOException聽e)聽{
聽聽聽聽聽聽聽聽聽聽聽聽log.error(
"Build聽Error"+templateFileName,e);
聽聽聽聽聽聽聽聽聽聽聽聽
returnfalse;
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
聽聽聽聽}
鍘熷洜灝卞湪浜嶰utputStreamWriter鐨勪笉鍚屾瀯閫犳柟娉?br />
OutputStreamWriter(OutputStream聽out)
聽聽聽聽聽聽聽聽聽聽鍒涘緩浣跨敤榛樿瀛楃緙栫爜鐨?OutputStreamWriter銆?br />
OutputStreamWriter(OutputStream聽out, String聽charsetName)
聽聽聽聽聽聽聽聽聽聽鍒涘緩浣跨敤鎸囧畾瀛楃闆嗙殑 OutputStreamWriter銆?br />
榪欎釜鏄腑鏂嘕DK鐨勬枃妗h鏄庯紝鍒氬紑濮嬫垜浣跨敤榛樿鐨勬瀯閫犲嚱鏁幫紝鎵浠ヤ嬌鐢ㄤ簡緋葷粺榛樿鐨勭紪鐮侊紝GBK錛屾墍浠ュ湪鐢熸垚闈欐佹枃浠剁殑鏃跺欐妸UTF-8鍐呭鐢℅BK緙栫爜鍐欏叆浜嗭紝鎵浠ュ湪UTF-8涓嬫祻瑙堝氨鏈夐棶棰樸?br />
榪樻湁鍏充簬淇敼妯$増鏂囦歡鍚屾牱涔熻娉ㄦ剰榪欎釜闂銆?br />
聽聽聽聽public聽String聽loadTemplate(String聽templateName)聽{
聽聽聽聽聽聽聽聽StringBuffer聽sb聽
=new聽StringBuffer();
聽聽聽聽聽聽聽聽
try聽{
聽聽聽聽聽聽聽聽聽聽聽聽File聽file聽
=new聽File(templatePath+"/"+templateName);
聽聽聽聽聽聽聽聽聽聽聽聽BufferedReader聽reader聽
=new聽BufferedReader(new聽InputStreamReader(new聽FileInputStream(file),"UTF-8"));
聽聽聽聽聽聽聽聽聽聽聽聽String聽line聽
=聽reader.readLine();
聽聽聽聽聽聽聽聽聽聽聽聽
while(line聽!=null)聽聽聽聽{
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽sb.append(line);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽sb.append(
"\r\n");
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽line聽
=聽reader.readLine();
聽聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽聽聽聽聽reader.close();
聽聽聽聽聽聽聽聽}聽
catch聽(IOException聽e)聽{
聽聽聽聽聽聽聽聽聽聽聽聽
thrownew聽SystemException("Loading聽template聽Error:",e);
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽
return聽sb.toString();
聽聽聽聽}
聽聽聽聽publicvoid聽saveTemplate(String聽templateName,聽String聽templateContent)聽{
聽聽聽聽聽聽聽聽
try聽{
聽聽聽聽聽聽聽聽聽聽聽聽File聽file聽
=new聽File(templatePath聽+"/"+聽templateName);
聽聽聽聽聽聽聽聽聽聽聽聽Writer聽out聽
=new聽BufferedWriter(new聽OutputStreamWriter(new聽FileOutputStream(file),"UTF-8"));
聽聽聽聽聽聽聽聽聽聽聽聽out.write(templateContent);
聽聽聽聽聽聽聽聽聽聽聽聽out.flush();
聽聽聽聽聽聽聽聽聽聽聽聽
//鎵斿嚭templatesave浜嬩歡
聽聽聽聽聽聽聽聽聽聽聽聽TemplateSaveEvent聽evt聽=new聽TemplateSaveEvent();
聽聽聽聽聽聽聽聽聽聽聽聽evt.setTemplateName(templateName);
聽聽聽聽聽聽聽聽聽聽聽聽dispatchTemplateEvent(evt);
聽聽聽聽聽聽聽聽}聽
catch聽(IOException聽e)聽{
聽聽聽聽聽聽聽聽聽聽聽聽
thrownew聽SystemException("Write聽template聽Error",e);
聽聽聽聽聽聽聽聽}
聽聽聽聽}



鑾 2006-06-21 10:46 鍙戣〃璇勮
]]>
主站蜘蛛池模板: va天堂va亚洲va影视中文字幕| 中文字幕av无码无卡免费| 亚洲AV无码久久精品色欲| 一本岛高清v不卡免费一三区| 亚洲6080yy久久无码产自国产| 久久久久亚洲精品无码网址 | 国产免费拔擦拔擦8x| 免费不卡中文字幕在线| 日本免费中文字幕| 亚洲爆乳精品无码一区二区| 亚洲成av人影院| 深夜国产福利99亚洲视频| 久久久久久精品免费看SSS| 爱情岛亚洲论坛在线观看| 精品亚洲成a人片在线观看 | 亚洲国产精品乱码一区二区| 日韩精品视频免费观看| 在线观看免费播放av片| 国产亚洲精品第一综合| 亚洲伊人久久大香线蕉在观 | 精品成人一区二区三区免费视频| 亚洲综合色丁香麻豆| 国产亚洲精品成人AA片新蒲金 | 一本岛高清v不卡免费一三区| 国产免费网站看v片在线| 搜日本一区二区三区免费高清视频| 亚洲娇小性xxxx色| 亚洲一级视频在线观看| 亚洲国产精品免费视频| 中文字幕在线亚洲精品| 亚洲中文字幕丝袜制服一区| 亚洲AV日韩精品一区二区三区| 男女啪啪永久免费观看网站| 性做久久久久久免费观看| 亚洲综合免费视频| 无码日韩精品一区二区免费| 毛片高清视频在线看免费观看| 午夜精品在线免费观看| 国产精品国产免费无码专区不卡| 成年午夜视频免费观看视频| 四虎在线免费播放|