欧美中文字幕在线,超碰免费在线播放,四虎影视成人http://www.aygfsteel.com/jelly/category/13984.html-Tech-Teczh-cnFri, 02 Mar 2007 06:50:49 GMTFri, 02 Mar 2007 06:50:49 GMT60Velocity亂碼問題。http://www.aygfsteel.com/jelly/archive/2006/08/11/62931.htmljellyjellyFri, 11 Aug 2006 02:46:00 GMThttp://www.aygfsteel.com/jelly/archive/2006/08/11/62931.htmlhttp://www.aygfsteel.com/jelly/comments/62931.htmlhttp://www.aygfsteel.com/jelly/archive/2006/08/11/62931.html#Feedback0http://www.aygfsteel.com/jelly/comments/commentRss/62931.htmlhttp://www.aygfsteel.com/jelly/services/trackbacks/62931.htmlSpring集成Velocity的時候出現了亂碼, 看源碼發現, Spring的使用的是Velocity的實現, 默認的是ISO(暈), 開始的時候, 以為簡單的:

<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
??<property name="cache" value="false" />
??<property name="prefix" value="" />
??<property name="suffix" value=".vm" />
??<property name="contentType" value="text/html;charset=UTF-8" />
?</bean>

這樣就可以解決問題, 沒想到, 還是亂碼,? 看了看Velocity相關的文檔, 于是改了改,

<bean id="velocifyConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
??? ?<property name="resourceLoaderPath" value="/WEB-INF/velocity/" />
??? ?<property name="velocityProperties">
??? ??<props>
??? ???<prop key="input.encoding">UTF-8</prop>
??? ???<prop key="output.encoding">UTF-8</prop>
??? ???<prop key="contentType">text/html;charset=UTF-8</prop>
??? ??</props>
??? ?</property>
??? </bean>

?<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
??<property name="cache" value="false" />
??<property name="prefix" value="" />
??<property name="suffix" value=".vm" />
??<property name="contentType" value="text/html;charset=UTF-8" />
?</bean>

在velocityConfig里添加了:

<property name="velocityProperties">
??? ??<props>
??? ???<prop key="input.encoding">UTF-8</prop>
??? ???<prop key="output.encoding">UTF-8</prop>
??? ???<prop key="contentType">text/html;charset=UTF-8</prop>
??? ??</props>
??? ?</property>
以為, 這下, 肯定可以了吧, 應該改的地方都改了, 高高興興的重啟了一下tomcat, 一訪問, faint仍然亂碼, 這下子崩潰了, 于是開始找, 找啊找, 找啊找, 怎么也是找不到, 看了spring的源碼看了velocity的源碼, 怎么也想不通(一晚上都沒睡好啊), 剛剛起來的時候, 沒辦法, UTF-8改成了GBK, ok, 不亂了, 不過, 變成了GBK, 總是感覺不爽, 不管, 反正是不亂了.



jelly 2006-08-11 10:46 發表評論
]]>
主站蜘蛛池模板: 平谷区| 云和县| 和龙市| 大方县| 兴宁市| 蓬安县| 永川市| 靖州| 罗江县| 恩施市| 吉安市| 枞阳县| 顺义区| 从江县| 许昌市| 务川| 文登市| 博乐市| 潍坊市| 高雄县| 桂林市| 禄劝| 长海县| 元谋县| 突泉县| 濉溪县| 巫山县| 巴楚县| 河北区| 高碑店市| 鄢陵县| 沂南县| 黄冈市| 潢川县| 衡东县| 安达市| 繁昌县| 疏勒县| 云安县| 双城市| 聂拉木县|