ï»??xml version="1.0" encoding="utf-8" standalone="yes"?>日韩av免费在线看,亚洲一区二区3,最新超碰在线http://www.aygfsteel.com/rory/Happy study,Happy work,Happy lifezh-cnSat, 17 May 2025 07:48:50 GMTSat, 17 May 2025 07:48:50 GMT60xstream对xmlnode的属æ€?attribute)è§£æžçš„问题[æ›´æ–°]ã€?/title>http://www.aygfsteel.com/rory/archive/2007/01/17/howto-dealwith-xstream-xmlnode-attribute.html莫多莫多Wed, 17 Jan 2007 10:24:00 GMThttp://www.aygfsteel.com/rory/archive/2007/01/17/howto-dealwith-xstream-xmlnode-attribute.htmlhttp://www.aygfsteel.com/rory/comments/94475.htmlhttp://www.aygfsteel.com/rory/archive/2007/01/17/howto-dealwith-xstream-xmlnode-attribute.html#Feedback2http://www.aygfsteel.com/rory/comments/commentRss/94475.htmlhttp://www.aygfsteel.com/rory/services/trackbacks/94475.html对于˜q™ç§èŠ‚ç‚¹æ ¼å¼çš„éžå¸¸çš„½Ž€å?br />
<result> Â Â Â Â <page>1</page> Â Â Â Â <pages>1</pages> Â Â Â Â <perpage>100</perpage> Â Â Â Â <total>19</total> Â Â Â Â <photos> Â Â Â Â Â Â Â Â <photo> Â Â Â Â Â Â Â Â Â Â Â Â <id>ff8080810fc8ac78010fd3f158d40a52</id> Â Â Â Â Â Â Â Â Â Â Â Â <owner>ff8080810f1a387b010f1a83d6530dfc</owner> Â Â Â Â Â Â Â Â Â Â Â Â <title>Gmail-2</title> Â Â Â Â Â Â Â Â Â Â Â Â <host>4</host> Â Â Â Â Â Â Â Â Â Â Â Â <dir>20061230</dir> Â Â Â Â Â Â Â Â Â Â Â Â <filename>231905_1463411198</filename> Â Â Â Â Â Â Â Â </photo> Â Â Â Â </photos> </result>
<result page="1" pages="1" perpage="100" total="19">     <photos>         <photo id="ff8080810fc8ac78010fd3f158d40a52"             owner="ff8080810f1a387b010f1a83d6530dfc" title="Gmail-2" host="4"             dir="20061230" filename="231905_1463411198" />     </photos> </result>
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!
/**  * @author <a href="mailto:rory.cn@gmail.com">somebody</a>  * @since Jan 16, 2007 6:12:35 PM  * @version $Id YupooResultConverter.java$  */ public class YupooResultConverter implements Converter {     /* (non-Javadoc)      * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object, com.thoughtworks.xstream.io.HierarchicalStreamWriter, com.thoughtworks.xstream.converters.MarshallingContext)      */     public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext context) {         // FIXME unfinish.     }
    /* (non-Javadoc)      * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader, com.thoughtworks.xstream.converters.UnmarshallingContext)      */     public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {         YupooResult result = new YupooResult();         result.setPage(new Integer(reader.getAttribute("page")));         result.setPages(new Integer(reader.getAttribute("pages")));         result.setPerpage(new Integer(reader.getAttribute("perpage")));         result.setTotal(new Integer(reader.getAttribute("total")));         reader.moveDown();         List<YupooPhoto> photos = new ArrayList<YupooPhoto>();         while(reader.hasMoreChildren()) {             reader.moveDown();             YupooPhoto photo = new YupooPhoto();             photo.setDir(reader.getAttribute("dir"));             photo.setFilename(reader.getAttribute("filename"));             photo.setHost(reader.getAttribute("host"));             photo.setId(reader.getAttribute("id"));             photo.setOwner(reader.getAttribute("owner"));             photo.setTitle(reader.getAttribute("title"));             photos.add(photo);             reader.moveUp();         }         result.setPhotos(photos);         return result;     }     /* (non-Javadoc)      * @see com.thoughtworks.xstream.converters.ConverterMatcher#canConvert(java.lang.Class)      */     public boolean canConvert(Class clazz) {         return clazz.equals(YupooResult.class);     } }
        stream.alias("result", YupooResult.class);         stream.useAttributeFor("page", Integer.class);         stream.useAttributeFor("pages", Integer.class);         stream.useAttributeFor("perpage", Integer.class);         stream.useAttributeFor("total", Integer.class);         stream.alias("photo", YupooPhoto.class);         stream.useAttributeFor("id", String.class);         stream.useAttributeFor("owner", String.class);         stream.useAttributeFor("title", String.class);         stream.useAttributeFor("host", String.class);         stream.useAttributeFor("dir", String.class);         stream.useAttributeFor("filename", String.class);
]]>åˆæ˜¯ä¹Þq 问题-Filter é…置也很é‡è¦http://www.aygfsteel.com/rory/archive/2006/12/27/character_encoding_problem_filtermapping_position.html莫多莫多Wed, 27 Dec 2006 02:37:00 GMThttp://www.aygfsteel.com/rory/archive/2006/12/27/character_encoding_problem_filtermapping_position.htmlhttp://www.aygfsteel.com/rory/comments/90236.htmlhttp://www.aygfsteel.com/rory/archive/2006/12/27/character_encoding_problem_filtermapping_position.html#Feedback3http://www.aygfsteel.com/rory/comments/commentRss/90236.htmlhttp://www.aygfsteel.com/rory/services/trackbacks/90236.html 上周更新了一下myblog,æ·ÕdŠ äº†ä¸€ä¸ªFilteråQŒåš¾lŸè®¡è®‰K—®ç”¨ã€‚坿˜¯åŽæ¥å‘现出çŽîCØ•ç 问题了。找了很久都没有扑ֈ°é—®é¢˜ã€‚debug的时候看åˆ?CharacterEncodingFilter¼‹®å®žæ˜¯æ‰§è¡Œäº†ã€‚丘q‡å°±æ˜¯æ²¡æœ‰æ•ˆæžœã€‚æ‰§è¡Œä¹‹å‰æ˜¯ISO-8859-1¾~–ç 的,执行之厘q˜æ˜¯åQ?CharacterEncodingFilterž®±æ²¡æœ‰è“våˆîC½œç”¨ã€‚åŽæ¥ç»ˆäºŽæ‰¾åˆ°é—®é¢˜çš„åŽŸå› äº†ã€‚åŽŸæ¥æ˜¯Filteré…置先厙åºåºçš„åŽŸå› ã€?br />      刚开始的é…置是这æ ïLš„:
    <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>
 先绘q‡é‚£ä¸ªç»Ÿè®¡çš„filterç„¶åŽå†ç»˜q‡ç¼–ç çš„filter。这æ ïLš„è¯ç¼–ç çš„filterž®×ƒ¸èµ·ä½œç”¨äº†ã€‚åªè¦å§¾~–ç çš„filter攑ֈ°æœ€å‰é¢ž®±æ²¡æœ‰é—®é¢˜äº†ã€‚改æˆè¿™æ ·å°±å¥½ã€?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 />  除ç»ç‰¹åˆ«æ³¨æ˜Žå¤?æœ¬æ–‡ç« ç‰ˆæƒå½’莫多泡æˆö所æœ? ¾|²å,éžå•†ä¸šç”¨é€?ä¿æŒä¸€è‡?   somebody(莫多)
]]>tuckey urlrewrite 3.x的问�/title>http://www.aygfsteel.com/rory/archive/2006/12/12/tuckey-urlrewrite_3-querystring-problem.html莫多莫多Tue, 12 Dec 2006 02:33:00 GMThttp://www.aygfsteel.com/rory/archive/2006/12/12/tuckey-urlrewrite_3-querystring-problem.htmlhttp://www.aygfsteel.com/rory/comments/87151.htmlhttp://www.aygfsteel.com/rory/archive/2006/12/12/tuckey-urlrewrite_3-querystring-problem.html#Feedback0http://www.aygfsteel.com/rory/comments/commentRss/87151.htmlhttp://www.aygfsteel.com/rory/services/trackbacks/87151.html
    <rule>         <from>^/article.asp\?id=(.*)$</from>         <to type="redirect">/entry/$1.jhtml</to>     </rule>
    但是我这æ ïLš„˜qžæŽ¥æ€ÀL˜¯åŒšw…ä¸åˆ°åQŒåªè¦åŽ»æŽ‰é‚£ä¸ªï¼Ÿž®±å¯ä»¥äº†ã€‚这个æ£åˆ™è¡¨è¾‘ּ是没有问题的ã€?article.asp?id=64是å¯ä»¥åŒ¹é…的到的ã€?br />Â Â Â åŽæ¥çœ?.0çš„manual (http://tuckey.org/urlrewrite/manual/3.0/)æ‰å‘çŽ°åŽŸæ¥æ˜¯˜q™ä¸ªçš„问题ã€?br />
<urlrewrite> element
The top level element.
Attribute
Possible Value
Explanation
default-match-type (optional)
regex (default)
All rules and thier conditions will be processed using the Java Regular Expression engine (unless match-type is specified on a rule).
wildcard
All rules and thier conditions will be processed using the Wildcard Expression engine (unless match-type is specified on a rule).
decode-using (optional)
utf8 (default)
When URL is decoded UTF-8 will be used.
null
Do not decode.
[encoding]
Any string representing a supported character encoding eg, ISO-8859-1. See Java Charset Object for more info.
use-query-string (optional)
false (default)
The query string will not be appended to the url that the "from" element matches against.
true
The query string will be appended to the url that the "from" element matches against.
use-context (optional)
false (default)
The context path will not be added to the url that the "from" element matches against.
true
The context path will be added to the url that the "from" element matches against.
/**  * @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é…置文äšg
    <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>
    <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>
    /**      * 转义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>      */     public static String escapeSQLLike(String likeStr) {         String str = StringUtils.replace(likeStr, "_", "/_");         str = StringUtils.replace(str, "%",    "/%");         str = StringUtils.replace(str, "?", "_");         str = StringUtils.replace(str, "*", "%");         return str;     }
 最˜q‘在负责一个大™å¹ç›®åQŒé¡¹ç›®ç»„æˆå‘˜åŒ…括™å¹ç›®¾lç†å¤§æ¦‚10个ähå·¦å³ã€‚项目技术用struts+spring+hibernate实现。项目的规模相对æ¥è¯´æ˜¯æ¯”较大的,æ€Õd…±æœ?0大模å—,æ¯ä¸ªå¤§æ¨¡å—åˆåˆ†äؓ有åå‡ ä¸ªã€ç”šè‡›_‡ å个ž®æ¨¡å—。开å‘å·¥å…ïL”¨eclipseåQŒç”±äºŽåœ¨å¼€å‘阶ŒDµï¼Œ™å¹ç›®å¼€å‘æˆå‘˜éœ€è¦é¢‘¾Jé‡å¯æœåŠ¡å™¨ã€‚åœ¨å¯åЍæœåŠ¡å™¨çš„æ—¶å€™ï¼Œæ¯æ¬¡å¯åŠ¨æ—‰™—´æ€ÀL˜¯ä¼šè¶…˜q?分钟。记得以å‰åœ¨åšå¦å¤–一个项目时åQŒå¯åŠ¨æ—¶é—´ä¸åˆ?¿U’é’ŸåQŒç›¸å·®äº†10å€ï¼Œè€Œä¸”™å¹ç›®è§„模是差ä¸å¤šçš„ã€?/span>
Â Â Â ä»Žåˆæ¥åˆ†æžæ¥è¯ß_¼Œåº”该是hibernate解释hbm.xml时花è´ÒŽ—¶é—ß_¼Œæˆ–者å¯èƒ½æ˜¯spring容器å¯åЍòq¶è§£é‡Šæ‰€æœ‰çš„beané…置文äšg。诊æ–了一下,å‘现1分钟消耗的旉™—´ä¸»è¦åˆ†å¸ƒåœ¨hibernate解释hbm.xmlèŠÞp´¹5¿U’ï¼›spring容器从å¯åŠ¨åˆ°è§£é‡Šbeané…置文äšg竟然èŠ×ƒº†58¿U’ï¼ŒçœŸæ˜¯å¤ªåš£å¼ äº†ã€‚å½“æ—‰™žå¸¸æ€€ç–‘spring的效率问题。ä¼å›¾ä»Ž¾|‘上æœçƒ¦ç›¸å…³èµ„æ–™åQŒçœ‹çœ‹æœ‰ä»€ä¹ˆä¼˜åŒ–措施ã€?/span>
   首先是找åˆîCº†hibernateçš„å¯åŠ¨ä¼˜åŒ?http://www.hibernate.org/194.html 里é¢çš„ä¸»è¦æ€æƒ³æ˜¯é€šè¿‡ž®†xmlåºåˆ—花到本地的文仉™‡ŒåQŒæ¯‹Æ¡è¯»å–çš„æ—¶å€™æ ¹æ®æƒ…况,从本地文件读å–åÆˆååºåˆ—化åQŒèŠ‚çœäº†hibernate xmlçš„è§£æžæ—¶é—´ã€‚æŒ‰ç…§è¿™ä¸ªæ–¹å¼æµ‹è¯•了一下,å‘现hibernateçš„å¯åŠ¨æ—¶é—´ä»Ž5¿U’é™ä½Žåˆ°3¿U’,但是˜q™ä¸ªä¼˜åŒ–对于整个å¯åЍ˜q‡ç¨‹æ˜¯æ¯æ°´èžR薪的åQŒæ¯«æ— 用处ã€?/span>
  ä¸è¿‡åœ¨è¿è¡ŒæœŸé—´ç¬¬ä¸€‹Æ¡ç‚¹™åµé¢çš„æ—¶å€™ï¼Œç”׃ºŽspringåšäº†lazy-loadåQŒçŽ°åœ¨å°±éœ€è¦å¯åŠ¨ä¸€éƒ¨åˆ†éœ€è¦çš„beansåQŒæ‰€ä»¥ç¨å¾®æ…¢2åQ?¿U’é’ŸåQŒä½†æ˜¯æ˜Žæ˜¾æ¯”½{‰å‡ åç§’è¦å¿«å¾ˆå¤šåQŒå€¼å¾—一鉴ã€?/span>
   以上是针对开å‘阶ŒD늚„spring容器å¯åŠ¨ä¼˜åŒ–åQŒåœ¨éƒ¨çÖv到实际环境ä¸åQŒå€’是没必è¦è®¾¾|®äØ“lazy-load。毕竟部¾|²åˆ°å®žé™…环境ä¸ä¸æ˜¯ç»å¸¸çš„äº‹ï¼Œæ¯æ¬¡å¯åЍ1åˆ†é’Ÿå€’ä¸æ˜¯å¤§é—®é¢˜ã€?
<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>
<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>
]]>˜q˜æ˜¯ä¹Þq 问题http://www.aygfsteel.com/rory/archive/2006/07/22/59567.html莫多莫多Sat, 22 Jul 2006 10:13:00 GMThttp://www.aygfsteel.com/rory/archive/2006/07/22/59567.htmlhttp://www.aygfsteel.com/rory/comments/59567.htmlhttp://www.aygfsteel.com/rory/archive/2006/07/22/59567.html#Feedback4http://www.aygfsteel.com/rory/comments/commentRss/59567.htmlhttp://www.aygfsteel.com/rory/services/trackbacks/59567.html    虽然™å¹ç›®å…¨éƒ¨é‡‡ç”¨äº†UTF-8¾~–ç åQŒæ‰€æœ‰çš„æºæ–‡ä»?.java,*.jsc,*.html,*.ftl都采用了UTF-8¾~–ç ã€‚å¯æ˜¯è¿˜æ˜¯å‡ºçŽîCº†ä¹Þq 问题。很是ä¸çˆ½ï¼ŒåŽæ¥æ‰‘Öˆ°äº†tomcatåQŒå’Œresin的酾|®ã€?/p>
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"/>
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.
    <!-- configures the default host, matching any host name -->     <host id="" root-directory=".">       <!--          - configures an explicit root web-app matching the          - webapp's ROOT         -->       <web-app id="/" document-directory="webapps/ROOT"/>       <web-app id="/community/jsvm2" document-directory="D:\\projects\\FelooComponents\\jsvm2"/>       <web-app id="/passport/jsvm2" document-directory="D:\\projects\\FelooComponents\\jsvm2"/>     </host>
        <web-app id="/community" document-directory="D:\\projects\\FelooCommunityWeb">           <path-mapping url-pattern='jsvm2/*'               real-path='D:\\projects\\FelooComponents\\jsvm2'/>       </web-app>                   <web-app id="/passport" document-directory="D:\\projects\\FelooPassportWeb">           <path-mapping url-pattern='jsvm2/*'               real-path='D:\\projects\\FelooComponents\\jsvm2'/>       </web-app>
  除ç»ç‰¹åˆ«æ³¨æ˜Žå¤?æœ¬æ–‡ç« ç‰ˆæƒå½’莫多泡æˆö所æœ? ¾|²å,éžå•†ä¸šç”¨é€?ä¿æŒä¸€è‡?   somebody(莫多)
    <servlet>         <servlet-name>dwr-invoker</servlet-name>         <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>         <init-param>           <param-name>debug</param-name>           <param-value>true</param-value>         </init-param>         <load-on-startup>1</load-on-startup>     </servlet>
å¯åЍæœåŠ¡åQŒæŠ±é”™äº†ã€?/p>
java.lang.IllegalArgumentException: DefaultContainer can't find a classes     at org.directwebremoting.impl.DefaultContainer.getBean(DefaultContainer.java:216)     at org.directwebremoting.annotations.AnnotationsConfigurator.configure(AnnotationsConfigurator.java:50)     at org.directwebremoting.servlet.DwrServlet.init(DwrServlet.java:121)
     在DWRçš„Maillisté‡Œé¢æœçƒ¦äº†ä¸€ä¸‹ï¼Œ˜q˜æœ‰½{”案åQŒåŽŸæ¥DWR2.0 åŠ å…¥äº†JDK5的注é‡?annotations).DwrServletåˆå§‹åŒ–的时候会åŽÀL£€æŸ¥æ³¨é‡Šçš„¾c»ï¼Œæ‰¾ä¸åˆ°å°±æŠ±é”™äº†ã€‚å¦‚æžœä½ ä¸ç”¨annotations也å¯ä»¥å¿½ç•¥æŽ‰˜q™ä¸ªé”™è¯¯ã€‚丘q‡çœ‹èµäh¥æ€ÀL˜¯ä¸çˆ½ã€‚有人æå‡ÞZº†æ–ÒŽ¡ˆã€‚è¿™æ ·å°±ok了ã€?/p>
    <servlet>         <servlet-name>dwr-invoker</servlet-name>         <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>         <init-param>           <param-name>debug</param-name>           <param-value>true</param-value>         </init-param>         <init-param>            <param-name>classes</param-name>            <param-value>java.lang.Object</param-value>         </init-param>         <load-on-startup>100</load-on-startup>     </servlet>
  除ç»ç‰¹åˆ«æ³¨æ˜Žå¤?æœ¬æ–‡ç« ç‰ˆæƒå½’莫多泡æˆö所æœ? ¾|²å,éžå•†ä¸šç”¨é€?ä¿æŒä¸€è‡?   somebody(莫多) Â
]]>关于Freemarker生æˆé™æ€æ–‡ä»¶çš„问题http://www.aygfsteel.com/rory/archive/2006/06/21/54134.html莫多莫多Wed, 21 Jun 2006 02:46:00 GMThttp://www.aygfsteel.com/rory/archive/2006/06/21/54134.htmlhttp://www.aygfsteel.com/rory/comments/54134.htmlhttp://www.aygfsteel.com/rory/archive/2006/06/21/54134.html#Feedback0http://www.aygfsteel.com/rory/comments/commentRss/54134.htmlhttp://www.aygfsteel.com/rory/services/trackbacks/54134.html使用FreeMarker生æˆHtml陿€æ–‡ä»?实例)ã€?br />     在我们的™å¹ç›®ä¸ä¹Ÿç”¨åˆ°äº†Freemarker生æˆé™æ€æ–‡ä»¶ã€‚丘q‡è¿™é‡Œæˆ‘è¦è¯´çš„æ˜¯¾~–ç 的问题。我们的™å¹ç›®ä½¿ç”¨çš„都是UTF-8¾~–ç åQŒæˆ‘直接使用 飞云ž®ä¾ æä¾›çš„æ–¹æ³•生æˆçš„æ–‡äšg在UTF-8¾~–ç 下察看是ä¹Þq åQŒè€ŒGBKæ£å¸¸(åŽæ¥å‘çŽ°å› äØ“æˆ‘ç”¨çš„ä¸æ–‡æ“作系¾lŸæ‰€ä»¥ç”¨GBK查看æ£å¸¸)ã€?br />     当然我把Freemarker的酾|®éƒ½æ”ÒŽˆäº†UTF-8åQŒæˆ‘的模版文件也是UTF-8¾~–ç çš„ã€‚ä¸‹é¢æ˜¯åŽŸæ¥çš„代ç ?br />
    public void 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) {             throw new SystemException("No Directory found,please check you config.");         }     }
    /**      * 生æˆé™æ€æ–‡ä»?br />     * @param templateFileName 模版åç§°eg:(biz/order.ftl)      * @param propMapÂ ç”¨äºŽå¤„ç†æ¨¡æ¿çš„属性Objectæ˜ å°„Â Â Â Â Â Â * @param htmlFilePath è¦ç”Ÿæˆçš„陿€æ–‡ä»¶çš„路径,相对讄¡½®ä¸çš„æ ¹èµ\å¾?例如 "/biz/2006/5/"      * @param htmlFileName è¦ç”Ÿæˆçš„æ–‡äšgå?例如 "123.htm"      * @return      */     private boolean buildHtml(String templateFileName,Map propMap, String htmlFilePath,String htmlFileName){         try {             Template template = freemarkerCfg.getTemplate(templateFileName);             template.setEncoding("UTF-8");             //创å¾ç”Ÿæˆæ–‡äšg目录             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();             return true;         } catch (TemplateException ex){             log.error("Build Error"+templateFileName,ex);             return false;         } catch (IOException e) {             log.error("Build Error"+templateFileName,e);             return false;         }             }
䏋颿˜¯ä¿®æ”¹ä¹‹åŽçš„代ç
    /**      * 生æˆé™æ€æ–‡ä»?br />     * @param templateFileName 模版åç§°eg:(biz/order.ftl)      * @param propMapÂ ç”¨äºŽå¤„ç†æ¨¡æ¿çš„属性Objectæ˜ å°„Â Â Â Â Â Â * @param htmlFilePath è¦ç”Ÿæˆçš„陿€æ–‡ä»¶çš„路径,相对讄¡½®ä¸çš„æ ¹èµ\å¾?例如 "/biz/2006/5/"      * @param htmlFileName è¦ç”Ÿæˆçš„æ–‡äšgå?例如 "123.htm"      * @return      */     private boolean buildHtml(String templateFileName,Map propMap, String htmlFilePath,String htmlFileName){         try {             Template template = freemarkerCfg.getTemplate(templateFileName);             template.setEncoding("UTF-8");             //创å¾ç”Ÿæˆæ–‡äšg目录             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();             return true;         } catch (TemplateException ex){             log.error("Build Error"+templateFileName,ex);             return false;         } catch (IOException e) {             log.error("Build Error"+templateFileName,e);             return false;         }             }
åŽŸå› ž®±åœ¨äºŽOutputStreamWriterçš„ä¸åŒæž„é€ æ–¹æ³?br /> OutputStreamWriter(OutputStream out)           创å¾ä½¿ç”¨é»˜è®¤å—符¾~–ç çš?OutputStreamWriterã€?br />OutputStreamWriter(OutputStream out, String charsetName)           创å¾ä½¿ç”¨æŒ‡å®šå—符集的 OutputStreamWriterã€?br />  ˜q™ä¸ªæ˜¯ä¸æ–‡JDKçš„æ–‡æ¡£è¯´æ˜Žï¼Œåˆšå¼€å§‹æˆ‘ä½¿ç”¨é»˜è®¤çš„æž„é€ å‡½æ•ŽÍ¼Œæ‰€ä»¥ä‹É用了¾pÈ»Ÿé»˜è®¤çš„ç¼–ç ,GBKåQŒæ‰€ä»¥åœ¨ç”Ÿæˆé™æ€æ–‡ä»¶çš„æ—¶å€™æŠŠUTF-8内容用GBK¾~–ç 写入了,所以在UTF-8下æµè§ˆå°±æœ‰é—®é¢˜ã€?br /> ˜q˜æœ‰å…³äºŽä¿®æ”¹æ¨¡ç‰ˆæ–‡äšgåŒæ ·ä¹Ÿè¦æ³¨æ„˜q™ä¸ªé—®é¢˜ã€?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) {             throw new SystemException("Loading template Error:",e);         }         return sb.toString();     }
    public void 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事äšg             TemplateSaveEvent evt = new TemplateSaveEvent();             evt.setTemplateName(templateName);             dispatchTemplateEvent(evt);         } catch (IOException e) {             throw new SystemException("Write template Error",e);         }     }