锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲aⅴ无码专区在线观看春色,亚洲福利视频一区二区三区,亚洲成a人不卡在线观看http://m.tkk7.com/wangxinsh55/category/14223.htmlzh-cnThu, 27 Oct 2011 13:51:33 GMTThu, 27 Oct 2011 13:51:33 GMT60Spring浜嬪姟閰嶇疆鐨勪簲縐嶆柟寮?/title><link>http://m.tkk7.com/wangxinsh55/archive/2011/10/27/362165.html</link><dc:creator>SIMONE</dc:creator><author>SIMONE</author><pubDate>Thu, 27 Oct 2011 06:31:00 GMT</pubDate><guid>http://m.tkk7.com/wangxinsh55/archive/2011/10/27/362165.html</guid><wfw:comment>http://m.tkk7.com/wangxinsh55/comments/362165.html</wfw:comment><comments>http://m.tkk7.com/wangxinsh55/archive/2011/10/27/362165.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/wangxinsh55/comments/commentRss/362165.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/wangxinsh55/services/trackbacks/362165.html</trackback:ping><description><![CDATA[     鎽樿: 鍘熸潵鏉ヨ嚜錛歨ttp://m.tkk7.com/robbie/archive/2009/04/05/264003.html    鍓嶆鏃墮棿瀵筍pring鐨勪簨鍔¢厤緗仛浜嗘瘮杈冩繁鍏ョ殑鐮旂┒錛屽湪姝や箣闂村Spring鐨勪簨鍔¢厤緗櫧璇翠篃閰嶇疆榪囷紝浣嗘槸涓鐩存病鏈変竴涓竻妤氱殑璁よ瘑銆傞氳繃榪欐鐨勫涔犲彂瑙塖pring鐨勪簨鍔¢厤緗彧瑕佹妸鎬濊礬鐞嗘竻錛岃繕鏄瘮杈冨ソ鎺屾彙鐨勩?  &n...  <a href='http://m.tkk7.com/wangxinsh55/archive/2011/10/27/362165.html'>闃呰鍏ㄦ枃</a><img src ="http://m.tkk7.com/wangxinsh55/aggbug/362165.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/wangxinsh55/" target="_blank">SIMONE</a> 2011-10-27 14:31 <a href="http://m.tkk7.com/wangxinsh55/archive/2011/10/27/362165.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>struts2 鏍囩涓殑璋冪敤Enum鏂規硶鎴栬皟鐢ㄥ唴閮ㄧ被涓殑闈欐佹柟娉?/title><link>http://m.tkk7.com/wangxinsh55/archive/2011/08/24/357191.html</link><dc:creator>SIMONE</dc:creator><author>SIMONE</author><pubDate>Wed, 24 Aug 2011 06:48:00 GMT</pubDate><guid>http://m.tkk7.com/wangxinsh55/archive/2011/08/24/357191.html</guid><wfw:comment>http://m.tkk7.com/wangxinsh55/comments/357191.html</wfw:comment><comments>http://m.tkk7.com/wangxinsh55/archive/2011/08/24/357191.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/wangxinsh55/comments/commentRss/357191.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/wangxinsh55/services/trackbacks/357191.html</trackback:ping><description><![CDATA[<div><div>com.duxiu.mobile.dao.web.WapRuleConfigDao榪欎釜涓轟竴涓被錛汣ustomPage鏄痗om.duxiu.mobile.dao.web.WapRuleConfigDao綾諱腑鐨凟num鎴栨槸鍐呴儴綾伙紝鍒橲truts2鏍囩涓皟鐢ㄧ殑鏂規硶濡備笅錛?/div><s:property value="@com.duxiu.mobile.dao.web.WapRuleConfigDao$CustomPage@login.value" /></div><img src ="http://m.tkk7.com/wangxinsh55/aggbug/357191.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/wangxinsh55/" target="_blank">SIMONE</a> 2011-08-24 14:48 <a href="http://m.tkk7.com/wangxinsh55/archive/2011/08/24/357191.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍘嗗彶涓婂叧浜巗truts2 閬嶅巻Map鏈鍏ㄧ殑鎬葷粨http://m.tkk7.com/wangxinsh55/archive/2010/09/21/332623.htmlSIMONESIMONETue, 21 Sep 2010 09:56:00 GMThttp://m.tkk7.com/wangxinsh55/archive/2010/09/21/332623.htmlhttp://m.tkk7.com/wangxinsh55/comments/332623.htmlhttp://m.tkk7.com/wangxinsh55/archive/2010/09/21/332623.html#Feedback0http://m.tkk7.com/wangxinsh55/comments/commentRss/332623.htmlhttp://m.tkk7.com/wangxinsh55/services/trackbacks/332623.htmlStruts2涓璱terator鏍囩閬嶅巻map鎬葷粨

閽堝浠ヤ笅鍑犵鎯呭喌鐨凪ap:

  •     private Map<String,String> map;   
  •       
  •     private Map<String,Student> studentMap;   
  •        
  •     private Map<String,String[]> arrayMap;   
  •        
  •     private Map<String,List<Student>> listMap;

  •  


  •         map=new HashMap<String,String>();   
  •         map.put("1""one");   
  •         map.put("2""two");   
  • 鐢ㄦ硶錛?/p>

  •    <s:iterator value="map" id="column">   
  •    <s:property value="#column"/><br>   
  •    key: <s:property value="key"/><br>   
  •    value:<s:property value="value"/><br>  
  •   </s:iterator>   
  •  


  •         studentMap=new HashMap<String,Student>();   
  •         studentMap.put("student1",new Student(new Long(1),"20034140201","寮犱笁1","鐢?,25));   
  •         studentMap.put("student2",new Student(new Long(2),"20034140202","寮犱笁2","濂?,26));   
  •         studentMap.put("student3",new Student(new Long(3),"20034140202","寮犱笁3","鐢?,27));    
  • 鐢ㄦ硶錛?/p>

     

  •     <s:iterator value="studentMap" id="column">   
  •     <tr>   
  •      <td><s:property value="#column"/></td>   
  •      <td><s:property value="value.id"/></td>   
  •      <td><s:property value="value.num"/></td>   
  •      <td><s:property value="value.name"/></td>   
  •      <td><s:property value="value.sex"/></td>   
  •      <td><s:property value="value.age"/></td>   
  •     </tr>   
  •     </s:iterator> 
  •  


  •         arrayMap=new HashMap<String,String[]>();   
  •         arrayMap.put("arr1"new String[]{"1","2003401","leejie","male","20"});   
  •         arrayMap.put("arr2"new String[]{"2","2003402","huanglie","male","25"});   
  •         arrayMap.put("arr3"new String[]{"3","2003403","lixiaoning","male","21"});   
  •            
  • 鐢ㄦ硶

     

  •     <s:iterator value="arrayMap" id="column">   
  •     <tr>   
  •      <td><s:property value="#column"/></td>   
  •      <td><s:property value="value[0]"/></td>   
  •      <td><s:property value="value[1]"/></td>   
  •      <td><s:property value="value[2]"/></td>   
  •      <td><s:property value="value[3]"/></td>   
  •      <td><s:property value="value[4]"/></td>   
  •     </tr>   
  •     </s:iterator>  
  •  


  •            
  •         listMap=new HashMap<String,List<Student>>();   
  •            
  •         List<Student> list1=new ArrayList<Student>();   
  •         list1.add(new Student(new Long(1),"20034140201","寮犱笁1","鐢?,25));   
  •         list1.add(new Student(new Long(2),"20034140202","寮犱笁2","鐢?,25));   
  •         list1.add(new Student(new Long(3),"20034140203","寮犱笁3","鐢?,25));   
  •         listMap.put("class1", list1);   
  •            
  •         List<Student> list2=new ArrayList<Student>();   
  •         list2.add(new Student(new Long(1),"20034140301","鏉庡洓1","鐢?,20));   
  •         list2.add(new Student(new Long(2),"20034140302","鏉庡洓2","鐢?,21));   
  •         list2.add(new Student(new Long(3),"20034140303","鏉庡洓3","鐢?,22));   
  •         list2.add(new Student(new Long(4),"20034140304","鏉庡洓4","鐢?,23));   
  •         listMap.put("class2", list2);   
  •  

    鐢ㄦ硶錛?/p>

  •    <s:iterator value="listMap" id="column">   
  •      <s:set name="total" value="#column.value.size"/>   
  •      <s:iterator value="#column.value" status="s">   
  •       <tr>   
  •         <s:if test="#s.first"><td rowspan="${total}"><s:property value="#column.key"/></td></s:if>   
  •         <td><s:property value="id"/></td>   
  •         <td><s:property value="num"/></td>   
  •         <td><s:property value="name"/></td>   
  •         <td><s:property value="sex"/></td>   
  •         <td><s:property value="age"/></td>   
  •       </tr>   
  •      </s:iterator>   
  •   </s:iterator>  


  • SIMONE 2010-09-21 17:56 鍙戣〃璇勮
    ]]>
    SpringSide 3 涓殑澶氭暟鎹簮閰嶇疆鐨勯棶棰?/title><link>http://m.tkk7.com/wangxinsh55/archive/2010/02/25/313859.html</link><dc:creator>SIMONE</dc:creator><author>SIMONE</author><pubDate>Thu, 25 Feb 2010 02:27:00 GMT</pubDate><guid>http://m.tkk7.com/wangxinsh55/archive/2010/02/25/313859.html</guid><wfw:comment>http://m.tkk7.com/wangxinsh55/comments/313859.html</wfw:comment><comments>http://m.tkk7.com/wangxinsh55/archive/2010/02/25/313859.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/wangxinsh55/comments/commentRss/313859.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/wangxinsh55/services/trackbacks/313859.html</trackback:ping><description><![CDATA[     鎽樿: 鍦⊿pringSide 3 涓紝鐧借。鎻愪緵鐨勯鍏堥厤緗ソ鐨勭幆澧冮潪甯告湁鍒╀簬鐢ㄦ埛榪涜蹇熷紑鍙戯紝浣嗘槸鍚屾椂涔熶細涓烘墿灞曞甫鏉ヤ竴浜涘洶闅俱傛渶鐩存帴鐨勪緥瀛愬氨鏄叧浜庡湪欏圭洰涓嬌鐢ㄥ涓暟鎹簮鐨勯棶棰橈紝浼間箮 寰堥毦鎼炪傚湪涓婁竴綃囦腑錛屾垜鎺㈣浜哠pringSide 3 涓殑鏁版嵁璁塊棶灞傦紝鍦ㄨ繖涓綃囦腑錛屾垜绔嬪織瑕佽В鍐沖鏁版嵁婧愰厤緗殑闅鵑錛屾垜鐨勬濊礬鏄繖鏍風殑錛? 絎竴姝ャ佹祴璇曡兘鍚﹂厤緗涓狣ataSource 絎簩姝ャ佹祴璇曡兘鍚﹂厤緗涓猄essi...  <a href='http://m.tkk7.com/wangxinsh55/archive/2010/02/25/313859.html'>闃呰鍏ㄦ枃</a><img src ="http://m.tkk7.com/wangxinsh55/aggbug/313859.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/wangxinsh55/" target="_blank">SIMONE</a> 2010-02-25 10:27 <a href="http://m.tkk7.com/wangxinsh55/archive/2010/02/25/313859.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>S2SH 妗嗘灦 鍩轟簬annotation閰嶇疆http://m.tkk7.com/wangxinsh55/archive/2010/02/24/313835.htmlSIMONESIMONEWed, 24 Feb 2010 14:06:00 GMThttp://m.tkk7.com/wangxinsh55/archive/2010/02/24/313835.htmlhttp://m.tkk7.com/wangxinsh55/comments/313835.htmlhttp://m.tkk7.com/wangxinsh55/archive/2010/02/24/313835.html#Feedback0http://m.tkk7.com/wangxinsh55/comments/commentRss/313835.htmlhttp://m.tkk7.com/wangxinsh55/services/trackbacks/313835.html闃呰鍏ㄦ枃

    SIMONE 2010-02-24 22:06 鍙戣〃璇勮
    ]]>
    struts2+spring鍙戦乵ailhttp://m.tkk7.com/wangxinsh55/archive/2009/05/15/270872.htmlSIMONESIMONEFri, 15 May 2009 08:27:00 GMThttp://m.tkk7.com/wangxinsh55/archive/2009/05/15/270872.htmlhttp://m.tkk7.com/wangxinsh55/comments/270872.htmlhttp://m.tkk7.com/wangxinsh55/archive/2009/05/15/270872.html#Feedback0http://m.tkk7.com/wangxinsh55/comments/commentRss/270872.htmlhttp://m.tkk7.com/wangxinsh55/services/trackbacks/270872.html

      spring涓湁闆嗘垚浜唈avamail錛屽湪浣跨敤妗嗘灦鐨勬椂鍊欑敤spring鏉ュ彂閫乵ail涔熸槸寰堟柟渚跨殑銆備笅闈㈡槸涓涓猻pring mail鐨勫皬渚嬪瓙銆?/p>

      鍦ㄨ繖涓緥瀛愪腑錛岄櫎浜嗛渶瑕乻truts鍜宻pring鐨勬鏋跺錛岃繕闇瑕乵ail.jar,activation.jar.

      web.xml鐨勪唬鐮侊細

      <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4"
     xmlns="  xmlns:xsi="  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
       <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath*:spring/*.xml</param-value>
     </context-param>

     <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>
        <!-- Spring refresh Introspector to prevent from out of memory  -->
     <listener>
      <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
     </listener>
     <!-- Support session scope, Spring bean -->
     <listener>                                                       
          <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
     </listener>
     <!-- Struts2 Action Mapping-->
     <filter>
            <filter-name>struts2</filter-name>
            <filter-class>
                org.apache.struts2.dispatcher.FilterDispatcher
            </filter-class>
        </filter>
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
       <!-- session time out -->
     <session-config>
      <session-timeout>30</session-timeout>
     </session-config>
     <!-- default index -->
     <welcome-file-list>
      <welcome-file>send.jsp</welcome-file>
     </welcome-file-list>
    </web-app>
    Java綾籑ailAction.java:

    package action;

    import org.springframework.mail.SimpleMailMessage;
    import org.springframework.mail.javamail.JavaMailSenderImpl;

    import com.opensymphony.xwork2.Action;
    import com.opensymphony.xwork2.ActionSupport;
    public class MailAction extends ActionSupport{
     private JavaMailSenderImpl mailSender;
     private SimpleMailMessage mailMessage;
      public String sendMail(){
      SimpleMailMessage msg = new SimpleMailMessage(mailMessage);
            msg.setText("Spring Mail Simple!");
            mailSender.send(msg);
            return Action.SUCCESS;
     }
      public void setMailMessage(SimpleMailMessage mailMessage) {
      this.mailMessage = mailMessage;
     }

     public void setMailSender(JavaMailSenderImpl mailSender) {
      this.mailSender = mailSender;
     }

    }
    spring閰嶇疆鏂囦歡applicationContext.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="
        xmlns:xsi="     xmlns:aop="     xmlns:tx="     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
               http://www.springframework.org/schema/tx     default-autowire="byName" default-lazy-init="true">

     <bean id="mailAction" class="action.MailAction">
      <property name="mailSender" ref="mailSender"/>
      <property name="mailMessage" ref="mailMessage"/>
     </bean>
     
     <bean id="mailSender"
              class="org.springframework.mail.javamail.JavaMailSenderImpl">
            <property name="host" value="smtp.163.com"/>
                <!-- mail  account   -->
            <property name="username" value="shwwwx"/>
            <property name="password" value="wwx1226"/>
            <property name="javaMailProperties">
                <props>
                    <prop key="mail.smtp.auth">true</prop>
                </props>
            </property>
        </bean>
          <!-- mail template -->
        <bean id="mailMessage" class="org.springframework.mail.SimpleMailMessage">
            <property name="to" value="
    shwwwx@163.com,nabelun@163.com"/>
            <property name="from" value="shwwwx@163.com"/>
            <property name="subject" value="Mail Simple"/>
        </bean>
    </beans>

    struts2鐨勯厤緗枃浠秙truts.xml:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        " <struts>
        <constant name="struts.objectFactory" value="spring" />
        <constant name="struts.devMode" value="false" />
        <constant name="struts.i18n.encoding" value="utf-8" />
        <package name="springtimer"   extends="struts-default">
           <action name="mailsend" class="mailAction" method="sendMail">
            <result>sendok.jsp</result>
            <interceptor-ref name="defaultStack"/>
           </action>
        </package>
    </struts>
    欏甸潰send.jsp:

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <html>
      <head>
        <title>My JSP 'send.jsp' starting page</title>
      </head>
      <body>
     <form action="mailsend.action" method="post">
      <input type="submit" value="閭歡鍙戦?>
     </form>
      </body>
    </html>

    欏甸潰sendok.jsp:

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>My JSP 'sendok.jsp' starting page</title>
      </head>
      <body>
        Send Mail Success! <br>
      </body>
    </html>
    榪愯send.jsp鍙戦侀偖浠訛紝鎴愬姛鐨勮瘽浼氳煩杞埌sendok.jsp欏甸潰銆?/p>

    SIMONE 2009-05-15 16:27 鍙戣〃璇勮
    ]]>
    struts2涓簩緇存暟緇勭殑鏄劇ずhttp://m.tkk7.com/wangxinsh55/archive/2009/02/24/256486.htmlSIMONESIMONETue, 24 Feb 2009 09:50:00 GMThttp://m.tkk7.com/wangxinsh55/archive/2009/02/24/256486.htmlhttp://m.tkk7.com/wangxinsh55/comments/256486.htmlhttp://m.tkk7.com/wangxinsh55/archive/2009/02/24/256486.html#Feedback0http://m.tkk7.com/wangxinsh55/comments/commentRss/256486.htmlhttp://m.tkk7.com/wangxinsh55/services/trackbacks/256486.html

    1銆佺敤涓ら噸寰幆鐨勬柟娉?/p>

    <s:iterator id="data1" value="#request.data" status="d1">
    <s:iterator id="data2" value="#request.data1" status="d2">
    <s:property value="#data2"/>
    </s:iterator>
    </s:iterator>

    2銆佺敤涓閲嶅驚鐜殑鏂規硶

    <s:iterator value="collection1" status="status">
    <s:property value="collection1[#status.index][0]"/>
    <s:property value="collection1[#status.index][1]"/>
    </s:iterator> 



    SIMONE 2009-02-24 17:50 鍙戣〃璇勮
    ]]>
    Struts AjaxTagshttp://m.tkk7.com/wangxinsh55/archive/2006/11/22/82757.htmlSIMONESIMONEWed, 22 Nov 2006 06:10:00 GMThttp://m.tkk7.com/wangxinsh55/archive/2006/11/22/82757.htmlhttp://m.tkk7.com/wangxinsh55/comments/82757.htmlhttp://m.tkk7.com/wangxinsh55/archive/2006/11/22/82757.html#Feedback0http://m.tkk7.com/wangxinsh55/comments/commentRss/82757.htmlhttp://m.tkk7.com/wangxinsh55/services/trackbacks/82757.htmlFrank W. Zammetti鎵╁睍浜哠truts鐨凾ag搴擄紝浣縎truts鍏峰浜咥JAX鍔熻兘銆?
    聽聽聽聽聽 錛堟敞錛氫笅闈㈢殑浠g爜寮曠敤鑷?strong>Frank W. Zammetti 鐨刟jaxtags鍖咃級
    聽聽聽聽聽 Tag搴撶殑鎵╁睍
    聽聽聽聽聽 1銆丗ormTag
    聽聽聽聽聽聽聽聽聽聽 澧炲姞浜唕efAjax灞炴т互鍙妔etter鍜実etter鏂規硶錛?/div>
    聽聽聽聽聽 2銆丅aseHandlerTag
    聽聽聽聽聽聽聽聽聽聽 澧炲姞浜唕efAjax灞炴т互鍙妔etter鍜実etter鏂規硶錛?/div>
    聽聽聽聽聽聽聽聽聽聽 鍚屾椂鎵╁睍浜唒repare脳脳脳Events鏂規硶錛屼嬌鍏跺姞杞紸jax灞炴э紝濡傦細
    聽聽聽聽聽聽聽聽聽聽 if (getOnkeydown() != null) {
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽......
    聽聽聽聽聽聽聽聽聽聽聽}
    聽聽聽聽聽聽聽聽聽聽聽/* Frank W. Zammetti */
    聽聽聽聽聽聽聽聽聽聽聽else {
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽聽prepareAjax("onkeydown", handlers);
    聽聽聽聽聽聽聽聽聽聽聽}
    聽聽聽聽聽聽聽聽聽聽聽/* Frank W. Zammetti */
    聽聽聽聽聽 3銆丼truts-Html.tld
    聽聽聽聽聽聽聽聽聽聽 澧炲姞浜唕efAjax灞炴э紱
    聽聽聽聽聽聽搴旂敤
    聽聽聽聽聽 1銆乤jax-config.xml
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽聽聽聽聽 <form ajaxRef="example1">
    聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽<element ajaxRef="button">
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽聽<event type="onclick">
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 //鍙戦佽姹傜殑璁劇疆
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽<requestHandler type="std:QueryString">
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽<target>example1.do</target>
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽<parameter>firstName=firstName,lastName=lastName</parameter>
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</requestHandler>
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 //鍥炶皟鍑芥暟錛堟柟娉曪級鍙婂洖鍐欏尯鍩熺殑璁劇疆
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽<responseHandler type="std:InnerHTML">
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽聽聽聽<parameter>example1_resultLayer</parameter>
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</responseHandler>
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽</event>
    聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽</element>
    聽聽聽聽聽聽聽聽 聽 </form>
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽2銆乻truts-config.xml
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽聽聽聽聽 //涓庡叾瀹傾ction鐨勫尯鍒槸錛欰jax璋冪敤鐨凙ction娌℃湁input鍜宖orward
    聽聽聽聽聽聽聽聽聽聽 <action path="/example1" name="example1Form" scope="request"
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽type="com.omnytex.ajaxtags.Example1Action" />
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽聽聽聽聽 //Ajax Tag Plugin
    聽聽聽聽聽聽聽聽聽聽 <plug-in className="org.apache.struts.taglib.html.ajax.AjaxInit" />
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽 3銆丣sp瀹㈡埛鐣岄潰
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽聽聽聽聽 //瀵瑰簲浜巃jax-config.xml涓殑form ajaxRef
    聽聽聽聽聽聽聽聽聽聽 <html:form action="example1" ajaxRef="example1">
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽......
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 //瀵瑰簲浜巃jax-config.xml涓殑Element ajaxRef
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <html:button property="button" value="Click to do Ajax!" ajaxRef="button" />
    聽聽聽聽聽聽聽聽聽聽 </html:form>
    聽聽聽聽聽聽聽聽聽聽聽Result:<br>
    聽聽聽聽聽聽聽聽聽聽聽//瀵瑰簲浜巃jax-config.xml涓殑responseHandler
    聽聽聽聽聽聽聽聽聽聽聽<span id="example1_resultLayer">&nbsp;</span>
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽聽聽聽聽 //鍚敤Ajax錛堝簲璇ユ斁鍦↗sp鐨勬渶鍚庯級
    聽聽聽聽聽聽聽聽聽聽 <html:enableAjax />
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽 4銆丄ction
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽聽聽聽 聽public ActionForward execute( ...... )聽throws Exception {
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 try {
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 //Ajax鐨凙ction闇瑕佽緭鍑哄唴瀹瑰埌out
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 PrintWriter out = response.getWriter();
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽聽out.println(......);
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽聽out.flush();
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽聽out.close();
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽} catch (Exception e) {
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽聽聽 System.err.println("Exception in Example1Action.execute(): " + e);
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽}
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 //鐢變簬Ajax鐨凙ction杈撳嚭鐨勫唴瀹圭敱欏甸潰鐨勫尯鍩熸帴鏀訛紝涓嶉渶瑕佽煩杞埌鍏跺畠欏甸潰
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 //鎵浠ワ紝榪斿洖null
    聽聽聽聽聽聽聽聽聽聽聽聽 聽聽 return null;
    聽聽聽聽聽聽聽聽聽聽聽}
    聽聽聽聽聽聽聽聽聽聽 ......
    聽聽聽聽聽聽Struts Ajax Tag宸ヤ綔鍘熺悊
    聽聽聽聽聽聽1銆丼truts鍚姩錛屽姞杞紸jaxInit錛?/div>
    聽聽聽聽聽 2銆丄jaxInit瑙f瀽ajax-config.xml錛?/div>
    聽聽聽聽聽 3銆丼truts鍔犺澆AjaxEnabled鐨凧sp錛?/div>
    聽聽聽聽聽 4銆丼truts-AjaxTag鏍規嵁Form ajaxRef鍜宔lment ajaxRef鎵懼埌ajax-config鐨勮緗紱
    聽聽聽聽聽 5銆佽緭鍑篈jaxEnabled鐨凥tml錛圱ag搴撳姞鍏ヤ簡Ajax闇瑕佺殑Script錛屽錛歑MLHttpRequest錛夛紱
    聽聽聽聽聽 6銆佺敤鎴瘋緭鍏ユ暟鎹紝鎻愪氦鏁版嵁錛堝紓姝ユā寮忔彁浜ゅ悗錛岀敤鎴峰彲浠ョ戶緇叾瀹冩搷浣滐級錛?/div>
    聽聽聽聽聽 7銆乆MLHttpRequest瀵硅薄鎺ョ鎻愪氦鏁版嵁錛屽茍鍚慡truts鎻愪氦do鍙婂弬鏁幫紱
    聽聽聽聽聽 8銆丼truts ActionServlet鍔犺澆FormBean錛屽拰鐩稿簲鐨凙ction錛?/div>
    聽聽聽聽聽 9銆丼truts Action鎵ц鐩稿簲閫昏緫錛屽緱鍒拌繑鍥炵殑鏁版嵁錛岄氳繃out杈撳嚭錛?/div>
    聽聽聽聽聽 10銆乆MLHttpRequest寰楀埌Struts榪斿洖鐨勬暟鎹紱
    聽聽聽聽聽聽11銆乆MLHttpRequest璋冪敤璁劇疆鐨勫洖璋冨嚱鏁幫紙鏂規硶錛夛紝杈撳嚭鏁版嵁鍒版寚瀹氱殑鍖哄煙錛?/div>

    SIMONE 2006-11-22 14:10 鍙戣〃璇勮
    ]]>Struts涓嬫媺鑿滃崟瀵瑰簲鏄劇ず(getDirectLabelValueBean )http://m.tkk7.com/wangxinsh55/archive/2006/11/16/81439.htmlSIMONESIMONEThu, 16 Nov 2006 01:44:00 GMThttp://m.tkk7.com/wangxinsh55/archive/2006/11/16/81439.htmlhttp://m.tkk7.com/wangxinsh55/comments/81439.htmlhttp://m.tkk7.com/wangxinsh55/archive/2006/11/16/81439.html#Feedback0http://m.tkk7.com/wangxinsh55/comments/commentRss/81439.htmlhttp://m.tkk7.com/wangxinsh55/services/trackbacks/81439.html2006-10-31 19:55

    ****************************************************************************************************************

    DAO閲岄潰濡備笅鍐欙細

    package com.sinoconcept.match.dao.impl;

    import java.util.List;

    import org.springframework.dao.DataAccessException;

    import com.sinoconcept.match.dao.DirctDAO;

    public class DirctDAOImpl extends BaseDAOHibernateImpl implements DirctDAO {

    聽public List loadAll(String className) {
    聽聽
    聽聽try {
    聽聽聽return this.getHibernateTemplate().loadAll(Class.forName(className));
    聽聽} catch (DataAccessException e) {
    聽聽聽// TODO Auto-generated catch block
    聽聽聽e.printStackTrace();
    聽聽} catch (ClassNotFoundException e) {
    聽聽聽// TODO Auto-generated catch block
    聽聽聽e.printStackTrace();
    聽聽}
    聽聽return null;
    聽}

    }

    ***************************************************************************************************************

    service閲屽涓嬪啓錛?/strong>

    package com.sinoconcept.match.service.impl;

    import java.lang.reflect.InvocationTargetException;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.List;

    import org.apache.struts.util.LabelValueBean;

    import com.sinoconcept.match.dao.DirctDAO;
    import com.sinoconcept.match.service.DirctService;

    public class DirctServiceImpl implements DirctService {
    聽private DirctDAO dirctDAO;

    聽public List getDirect(String dirName) {

    聽聽List result = this.getDir(dirName);
    聽聽return result;
    聽}

    聽public List getDirectLabelValueBean(String dirName) {

    聽聽List result = this.getDirLableValueBean(dirName);
    聽聽return result;
    聽}

    聽public List getDir(String dirName) {
    聽聽List result = null;

    聽聽result = dirctDAO.loadAll(dirName);

    聽聽return result;
    聽}

    聽@SuppressWarnings("unchecked")
    聽public List getDirLableValueBean(String dirName) {
    聽聽List result = new LinkedList();
    聽聽List list = getDir(dirName);
    聽聽Iterator it = list.iterator();
    聽聽while (it.hasNext()) {
    聽聽聽Object obj = it.next();
    聽聽聽LabelValueBean lv = new LabelValueBean();
    聽聽聽String label = null;
    聽聽聽try {
    聽聽聽聽label = obj.getClass().getMethod("getName", new Class[] {})
    聽聽聽聽聽聽.invoke(obj, null).toString();
    聽聽聽} catch (Exception e) {
    聽聽聽聽try {
    聽聽聽聽聽label = obj.getClass()
    聽聽聽聽聽聽聽.getMethod("getValue", new Class[] {}).invoke(obj,
    聽聽聽聽聽聽聽聽聽null).toString();
    聽聽聽聽} catch (IllegalArgumentException e1) {
    聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽e1.printStackTrace();
    聽聽聽聽} catch (SecurityException e1) {
    聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽e1.printStackTrace();
    聽聽聽聽} catch (IllegalAccessException e1) {
    聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽e1.printStackTrace();
    聽聽聽聽} catch (InvocationTargetException e1) {
    聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽e1.printStackTrace();
    聽聽聽聽} catch (NoSuchMethodException e1) {
    聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽e1.printStackTrace();
    聽聽聽聽}
    聽聽聽} finally {
    聽聽聽聽if (label == null)
    聽聽聽聽聽try {
    聽聽聽聽聽聽label = label = obj.getClass().getMethod("getValue",
    聽聽聽聽聽聽聽聽new Class[] {}).invoke(obj, null).toString();
    聽聽聽聽聽} catch (IllegalArgumentException e) {
    聽聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽聽e.printStackTrace();
    聽聽聽聽聽} catch (SecurityException e) {
    聽聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽聽e.printStackTrace();
    聽聽聽聽聽} catch (IllegalAccessException e) {
    聽聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽聽e.printStackTrace();
    聽聽聽聽聽} catch (InvocationTargetException e) {
    聽聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽聽e.printStackTrace();
    聽聽聽聽聽} catch (NoSuchMethodException e) {
    聽聽聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽聽聽e.printStackTrace();
    聽聽聽聽聽}
    聽聽聽}
    聽聽聽lv.setLabel(label);
    聽聽聽try {
    聽聽聽聽lv.setValue(obj.getClass().getMethod("getId", new Class[] {})
    聽聽聽聽聽聽.invoke(obj, null).toString());
    聽聽聽} catch (IllegalArgumentException e) {
    聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽e.printStackTrace();
    聽聽聽} catch (SecurityException e) {
    聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽e.printStackTrace();
    聽聽聽} catch (IllegalAccessException e) {
    聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽e.printStackTrace();
    聽聽聽} catch (InvocationTargetException e) {
    聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽e.printStackTrace();
    聽聽聽} catch (NoSuchMethodException e) {
    聽聽聽聽// TODO Auto-generated catch block
    聽聽聽聽e.printStackTrace();
    聽聽聽}
    聽聽聽result.add(lv);
    聽聽}
    聽聽return result;
    聽}

    聽public DirctDAO getDirctDAO() {
    聽聽return dirctDAO;
    聽}

    聽public void setDirctDAO(DirctDAO dirctDAO) {
    聽聽this.dirctDAO = dirctDAO;
    聽}

    }

    ***********************************************************************************************************************

    Action閲岄潰濡備笅璁劇疆錛?/p>

    String status = request.getParameter("status");
    聽聽if (status == null || status.equals("")) {
    聽聽聽status = "0";
    聽聽}

    List sttusList = dirctService
    聽聽聽聽.getDirectLabelValueBean("com.sinoconcept.match.domain.DrStatus");//鏁版嵁瀛楀吀琛?/strong>

    //DrStatus 鏁版嵁鏄犺鏂囦歡鍙浜屼釜瀛楁錛歱rivate Integer id錛沺rivate String value;

    manDiaryForm.setStatus(status);

    request.setAttribute("statusList", sttusList);

    ****************************************************************************************************************

    欏甸潰涓婂涓嬭幏寰楋細

    <html:select property="status" onchange="sel()">
    聽聽聽聽聽聽聽<html:optionsCollection name="statusList" />
    聽聽聽聽聽聽</html:select>



    SIMONE 2006-11-16 09:44 鍙戣〃璇勮
    ]]>Struts Validation妗嗘灦嫻呭皾2http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64197.htmlSIMONESIMONEThu, 17 Aug 2006 11:51:00 GMThttp://m.tkk7.com/wangxinsh55/archive/2006/08/17/64197.htmlhttp://m.tkk7.com/wangxinsh55/comments/64197.htmlhttp://m.tkk7.com/wangxinsh55/archive/2006/08/17/64197.html#Feedback0http://m.tkk7.com/wangxinsh55/comments/commentRss/64197.htmlhttp://m.tkk7.com/wangxinsh55/services/trackbacks/64197.html javascript 鏀寔

    聽聽聽聽聽聽 鍦?/span> web 搴旂敤涓紝浣跨敤 javascript 鐨勬満浼氶潪甯稿銆傝櫧鐒朵笉灝戜功涓婃彁鍙婂鎴鋒湁鍙兘浠庢祻瑙堝櫒鍏抽棴 js 鐨勬墽琛岋紝浣嗘槸瑕佹兂瀹屽叏鐨勪笉浣跨敤瀹冿紝鐩墠鐪嬫潵濂藉儚榪樹笉琛屻傛瘮濡備竴浜涘鏉傜殑 UI 鏄繀欏婚氳繃 js 鏉ュ疄鐜扮殑錛堝涓嬫媺寮忚彍鍗曠瓑絳夛級銆傞偅涔?/span> validation 妗嗘灦鏀笉鏀寔瀹㈡埛绔殑 js 楠岃瘉鍛紵

    絳旀鏄細褰撶劧銆傚叿浣撳仛娉曟槸錛?/span>

    -聽聽聽聽聽聽聽聽聽 鍦ㄩ〉闈?/span> html:form 鏍囩鍐呴儴娣誨姞 onsubmit="return validateEditForm(this);" 錛堝叿浣撶殑璇硶錛?/span> validate+ 鍦?/span> validation.xml 鏂囦歡涓畾涔夌殑 form 鐨勫悕瀛楋級錛涘錛?/span>

    <html:form action="<%=action%>" method="post" onsubmit="return validateEditForm(this);">

    -聽聽聽聽聽聽聽聽聽 鍦?/span> html:form 鍐呴儴鍧椾腑娣誨姞錛?/span> <html:javascript formName="editForm"/>

    聽聽聽聽聽聽 濡傛 2 姝ュ嵆鍙傝櫧鐒訛紝 validation 妗嗘灦闈炲父綆鍗曟槗鐢紝浣嗘槸榪樻槸鏈夐渶瑕佹敞鎰忕殑鍦版柟銆?/span>

    浣跨敤娉ㄦ剰

    1.聽聽聽聽聽聽 浣跨敤 validation 妗嗘灦鍚庯紝 form 蹇呴』浠?/span> ValidatorForm 涓淳鐢燂紝鍚屾椂蹇呴』鍦ㄤ綘鐨?/span> validate 鏂規硶涓厛璋冪敤鍩虹被鐨?/span> validate 鏂規硶銆傚浜庝嬌鐢?/span> Dyna 寮澶寸殑鏂規硶鏉ュ垱寤?/span> formbean 鐨勮鑰咃紝浣犱篃蹇呴』鏀逛負浠?/span> dyna 寮澶村惈鏈?/span> validator 鐨?/span> form 銆?/span>

    2.聽聽聽聽聽聽 娉ㄦ剰 DynaValidatorForm 錛?/span> ValidatorForm 錛夊拰 DynaValidatorActionForm 錛?/span> ValidatorActionForm 錛夌殑鍖哄埆銆傚垰寮濮嬫椂浠庡府鍔╀腑娌$湅鏄庣櫧榪?/span> 2 鑰呯殑鍖哄埆錛屽悗鏉ヤ粠緗戜笂涓綃囨枃绔犱腑寰楀埌浜嗙敤娉曠殑鍖哄埆銆傚墠鑰呬富瑕佺殑瑙嗚鏄?/span> formbean 錛岃屽悗鑰呯殑瑙嗚鏄?/span> action 銆?/span>

    褰?/span> formbean 琚笉鍚岀殑 action 浣跨敤鏃訛紝瀵逛簬涓嶅悓鐨?/span> action 鑰岃█錛屼嬌鐢ㄧ殑 formbean 鐨勫睘鎬ч泦鍚堟湁澶ф湁灝忋傛鏃跺鏋滀粛鐒朵互 formbean 涓轟富浣擄紝浼氶犳垚鍏朵粬 action 鐨勪笉姝e父浣跨敤銆傚洜姝わ紝 struts 涓彁鍑轟簡 DynaValidatorActionForm 錛?/span> ValidatorActionForm 錛夈傛鏃跺湪 validation.xml 涓殑 form 鏍囩鐨?/span> name 灞炴ф敼涓?/span> action 鐨?/span> path 灞炴э紝鍙堢敱浜?/span> action 涓湁 attribute 鍜?/span> name 灞炴э紝 validation 妗嗘灦灝卞彲鏍規嵁榪欎釜 action 寰楀埌瀵瑰簲鐨?/span> formbean 銆備緥瀛愶細

    <formset>

    <form name="/createAddress">

    聽聽聽 <field property="city"

    聽聽聽聽聽聽聽聽聽 depends="required">

    聽聽聽聽聽 <arg0 key="prompt.city"/>

    聽聽聽 </field>

    </form>

    <form name="/editAddress">

    聽聽聽 <field property="state"

    聽聽聽聽聽聽聽聽聽 depends="required">

    聽聽聽聽聽 <arg0 key="prompt.state"/>

    聽聽聽 </field>

    </form>

    </formset>

    3.聽聽聽聽聽聽 涓?/span> DispatchAction 鐨勯厤鍚堛?/span> Struts1.1 鐨?/span> DispatchAction 浣垮緱鐩稿叧鐨?/span> Action 鐨勫叧緋葷揣瀵嗭紝澶уぇ鍑忓皯浜嗗簲鐢ㄤ腑 Action 鐨勪釜鏁幫紝浣嗘槸闅忎箣鑰屾潵涔熷甫鏉ヤ簡浣跨敤 Validation 妗嗘灦鐨勪笉渚匡紝涓嶈兘涓嶈鏄竴涓仐鎲俱傝鑰呬篃璁歌涓鴻繖縐嶆儏鍐靛彲浠ヤ嬌鐢ㄧ 2 鏉$殑瑙e喅鏂規鏉ヨВ鍐籌紝鍗抽噰鐢?/span> DyanValidatorActionForm 錛岀劧鍚庡湪 Validation.xml 鏂囦歡涓?/span> form 鐨勫悕縐頒嬌鐢ㄤ笉鍚岀殑 Actiond 鐨?/span> path 錛屽嵆鍦?/span> validation.xml 涓嬌鐢細 <form name="/user.do?method=doAdd"> 銆?/span> 聽聽聽 <form name="/user.do?method=doLoad"> 銆傜劧鑰岋紝鍦ㄧ洰鍓嶇殑鐗堟湰涓?/span> Validation 妗嗘灦騫朵笉鏀寔榪欑杈ㄨ銆備竴縐嶇粫榪囪繖涓儏鍐電殑鏂規硶鏄紝閽堝鍚屼竴涓?/span> Action 瀹炵幇綾誨湪 Struts-config.xml 鏂囦歡涓畾涔夊涓?/span> Action 鐨?/span> path 錛屽湪涓嶉渶瑕佽繘琛岄獙璇佺殑鍦版柟灝?/span> Action 鐨?/span> validate 灞炴х疆涓?/span> false 銆傚嵆錛?/span>

    struts-config.xml 錛?/span>

    <action attribute="editForm" path="/user" name="editForm" input="/editUser.jsp"

    parameter="method" scope="request" type="foxgem.struts.UserDispatchAction"

    聽聽聽聽 validate="true">

    聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <forward name="load" path="/editUser.jsp"/>

    聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <forward name="action" path="/userquery.do?pageId=1"/>

    </action>

    聽聽聽聽聽聽聽

    <action attribute="editForm" path="/loaduser" name="editForm" input="/editUser.jsp"

    聽聽聽聽聽聽聽 parameter="method" scope="request" type="foxgem.struts.UserDispatchAction"

    聽聽聽聽聽聽聽 validate="false">

    聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <forward name="load" path="/editUser.jsp"/>

    聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <forward name="action" path="/userquery.do?pageId=1"/>

    </action>

    鐒跺悗鍦?/span> validation.xml 鏂囦歡涓嬌鐢?/span> 2 鐨勬柟娉曘?/span>

    緇撴潫璇?/font>

    聽聽聽聽聽聽 鎬葷殑璇存潵錛?/span> validation 妗嗘灦澶уぇ鐨勬彁楂樹簡欏甸潰楠岃瘉鐨勫紑鍙戞晥鐜囷紝鏇村惛寮曚漢鐨勬槸榪欎簺楠岃瘉鏂規硶鍙氳繃鑷畾涔夌殑 validator 鏉ュ緱鍒板鐢ㄣ備嬌寰楄繖浜涢獙璇佷唬鐮佹洿鍔犻泦涓紝鍙淮鎶ゆу緱鍒板姞寮恒傚綋鐒墮殢鐫欏圭洰鐨勮繘琛岋紝 validation.xml 鍜?/span> validator-rules.xml 浼氶殢涔嬪闀匡紝榪欓儴鍒嗙殑緇存姢宸ヤ綔鍔犻噸浜嗐?/span>

    聽聽聽聽聽聽 鍚屾椂錛岀敱浜庝笉鑳介潪甯稿ソ鐨勫拰 DispatchAction 涓璧峰崗浣滐紝涔熶嬌寰楀ぇ閲忎嬌鐢?/span> DispatchAction 鐨勯」鐩笉鑳介潪甯稿ソ鐨勪嬌鐢ㄥ畠銆傚緩璁ぇ閲忎嬌鐢?/span> DispatchAction 鍜岄〉闈㈤獙璇侀潪甯稿鏉傚鍙樼殑欏圭洰鍙互鏆傛椂鎸夊師鏉ョ殑鏂規硶鏉ラ獙璇侊紝涓嶄嬌鐢?/span> validation 妗嗘灦銆?/span>

    聽聽聽聽聽聽 鑷充簬 validation 妗嗘灦鐨勫叾浠栬緇嗕俊鎭紝璇峰弬瑙?/span> struts 鐨勬枃妗o紝鍦ㄦ涓嶅啀璧樿堪銆?/span>

    鍙傝冭祫鏂?/font>

    n聽聽聽聽聽聽聽聽 http://raibledesigns.com/wiki/Wiki.jsp?page=SecuringDispatchAction DispatchAction 涓?/span> validation 妗嗘灦鐨勫崗浣滆В鍐蟲柟妗堟潵婧愪簬姝ゃ?/span>

    n聽聽聽聽聽聽聽聽 http://otn.oracle.com/oramag/oracle/04-jan/o14dev_struts.html Check Your Form with Validator

    n聽聽聽聽聽聽聽聽 http://www-900.ibm.com/developerWorks/cn/java/l-struts1-1/ 娣卞叆 Struts 1.1

    n聽聽聽聽聽聽聽聽 http://javaboutique.internet.com/tutorials/Struts11Val/ Stepping through the Struts 1.1 Validator



    SIMONE 2006-08-17 19:51 鍙戣〃璇勮
    ]]>
    Struts Validator楠岃瘉鍣ㄤ嬌鐢ㄦ寚鍗?/title><link>http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64191.html</link><dc:creator>SIMONE</dc:creator><author>SIMONE</author><pubDate>Thu, 17 Aug 2006 11:32:00 GMT</pubDate><guid>http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64191.html</guid><wfw:comment>http://m.tkk7.com/wangxinsh55/comments/64191.html</wfw:comment><comments>http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64191.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/wangxinsh55/comments/commentRss/64191.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/wangxinsh55/services/trackbacks/64191.html</trackback:ping><description><![CDATA[     鎽樿: 浣滆咃細 David Winterfeldt 澶у崼 James Turner 瑭瑰鏂? Rob Leland 緗椾集鐗? 緲昏瘧錛? 聽聽聽聽聽聽 渚濊秴 楠岃瘉鍣細 ...  <a href='http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64191.html'>闃呰鍏ㄦ枃</a><img src ="http://m.tkk7.com/wangxinsh55/aggbug/64191.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/wangxinsh55/" target="_blank">SIMONE</a> 2006-08-17 19:32 <a href="http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64191.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>struts銆乻pring銆乭ibernate涓枃涔辯爜闂瑙e喅 http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64185.htmlSIMONESIMONEThu, 17 Aug 2006 11:01:00 GMThttp://m.tkk7.com/wangxinsh55/archive/2006/08/17/64185.htmlhttp://m.tkk7.com/wangxinsh55/comments/64185.htmlhttp://m.tkk7.com/wangxinsh55/archive/2006/08/17/64185.html#Feedback0http://m.tkk7.com/wangxinsh55/comments/commentRss/64185.htmlhttp://m.tkk7.com/wangxinsh55/services/trackbacks/64185.html 聽聽聽聽聽 榪戞棩錛屼嬌鐢╯truts 1.1錛屽彂鐜拌鍘岀殑涓枃涔辯爜闂錛屽湪form鐨勪紶閫佽繃紼嬪拰鍏ュ簱鏃跺欏嚭鐜般傚氨鎴戝湪緗戠粶涓婃壘鐨勬柟娉曠綏鍒楀涓嬶細
    錛圱omcat 5.0.28+struts 1.1+hibernate 2.1+sqlserver2k錛?br />1.鐩存帴杞紪鐮乸ublic static String isoToGB(String src){聽聽聽
    String strRet=null;聽聽聽
    try{聽聽聽聽
    聽 strRet = new String(src.getBytes("ISO_8859_1"),"GB2312");聽聽
    聽 }catch(Exception e)聽聽聽 {聽聽聽聽聽聽聽聽聽
    }聽聽聽 return strRet;
    }閫氳繃涓涓嚱鏁拌漿緙栫爜錛屾垜娌℃湁鎴愬姛錛屼笉鐭ヤ負浣曪紒

    2.榪囨護filter璁劇疆娉?br />
    package yourbean;

    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;

    public class servfilter extends HttpServlet implements Filter {聽 private FilterConfig filterConfig;聽 //Handle the passed-in FilterConfig聽 public void init(FilterConfig filterConfig) {聽聽聽 this.filterConfig = filterConfig;聽 }聽 //Process the request/response pair聽 public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) {聽聽聽 try {聽聽聽聽聽 request.setCharacterEncoding("GB2312");聽聽聽聽聽聽 ((HttpServletResponse)response).setHeader("Cache-control","no-cache");聽聽聽聽聽 response.setHeader("Pragma","No-cache");聽response.setHeader("Cache-Control","no-cache");聽response.setHeader("Expires","0");聽聽聽聽聽聽 ((HttpServletResponse)response).setHeader("Pragram","no-cache");聽聽聽聽聽 filterChain.doFilter(request, response);聽聽聽 }聽聽聽 catch(ServletException sx) {聽聽聽聽聽 filterConfig.getServletContext().log(sx.getMessage());聽聽聽 }聽聽聽 catch(IOException iox) {聽聽聽聽聽 filterConfig.getServletContext().log(iox.getMessage());聽聽聽 }聽 }聽 //Clean up resources聽 public void destroy() {聽 }}涓嬮潰鏄竴涓獁eb.xml鏂囦歡浣犵敤jbuilder鍐欎笂闈㈢殑bean鐨勬椂鍊欎細鐢熸垚涓涓?lt;?xml version="1.0" encoding="ISO-8859-1"?>

    <!DOCTYPE web-app聽聽聽 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"聽聽聽 "http://java.sun.com/dtd/web-app_2_3.dtd">

    <web-app>聽 <display-name>Welcome to Tomcat</display-name>聽 <description>聽聽聽聽 Welcome to Tomcat聽 </description>聽 <filter>聽聽聽 <filter-name>servfilter</filter-name>聽聽聽 <filter-class>yourbean.servfilter</filter-class>聽 </filter>聽 <filter-mapping>聽聽聽 <filter-name>servfilter</filter-name>聽聽聽 <url-pattern>/*</url-pattern>聽 </filter-mapping></web-app>鎶婁笂闈㈢殑servfilter緙栬瘧鏀懼湪浣犵殑web-inf/classes/yourbean/涓媤eb.xml鏀懼湪web-inf/涓嬪拰classes鍦ㄤ竴涓洰褰曚笅鍦ㄦ瘡涓猨sp欏甸潰涓婂姞涓?lt;%@page contentType="text/html;charset=GBK"%>

    涔熶笉鏄緢鏂逛究錛岃屼笖鍦╰omcat涔熸病鏈夋垚鍔燂紝緇х畫閮侀椃錛?br />
    3.鎴戠幇鍦ㄤ嬌鐢ㄦ柟娉曪紝鎺ㄨ崘錛侊紒

    鍐欎竴涓猰yActionServlet鏉ュ茍瑕嗙洊ActionServlet涓殑process錛堬級鏂規硶銆?br />
    聽 protected void process(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException {聽聽聽 /**@todo Override this org.apache.struts.action.ActionServlet method*/聽聽聽 request.setCharacterEncoding("GB2312");//灝卞姞鐫涓琛屼竴鍒囬兘瑙e喅浜喡犅犅?super.process(request, response);聽 }

    褰撶劧鍒繕浜嗘敼涓涓媤eb.xml閲岄潰鐨勯厤緗?<servlet>聽聽聽 <servlet-name>action</servlet-name>聽聽聽 <servlet-class>strutsdemo.myActionServlet</servlet-class>聽聽聽 <init-param>聽聽聽聽聽 <param-name>debug</param-name>聽聽聽聽聽 <param-value>2</param-value>聽聽聽 </init-param>聽聽聽 <init-param>聽聽聽聽聽 <param-name>config</param-name>聽聽聽聽聽 <param-value>/WEB-INF/struts-config.xml</param-value>聽聽聽 </init-param>聽聽聽 <load-on-startup>2</load-on-startup>聽 </servlet>

    鏀逛竴涓媠ervlet-class鏍囩涓殑鍐呭灝卞彲浠ワ紒

    鐪熺殑鍙互錛屼竴鍔崇敤yi錛?br />
    鍏蜂綋緙栫爜鐨勭悊璁哄氨涓嶈浜嗭紝google涓婂凡緇忓澶氫簡銆?br />
    鍙﹀錛屽鏋滀笉鐢╯truts鐨勮瘽錛宧ibernate涔熷彲鑳界鍒頒腑鏂囦貢鐮侀棶棰橈紝鍙鍦╤ibernate.cfg.xml閰嶇疆涓涓嬶細

    <property name="hibernate.connection.url">聽聽聽jdbc:microsoft:sqlserver://Localhost:1433;SelectMethod=cursor;characterEncoding=GBK;DatabaseName=myDatabase.聽聽</property>

    characterEncoding=GBK錛佸氨鍙互浜嗐?br />


    ********************************************************************************************************************

    Java/J2EE涓枃闂緇堟瀬瑙e喅涔嬮亾

    Java涓枃闂涓鐩村洶鎵扮潃寰堝鍒濆鑰咃紝濡傛灉浜嗚В浜咼ava緋葷粺鐨勪腑鏂囬棶棰樺師鐞嗭紝鎴戜滑灝卞彲浠ュ涓枃闂鑳藉閲囧彇鏍規湰鐨勮В鍐充箣閬撱?

    銆銆鏈鍙よ佺殑瑙e喅鏂規鏄嬌鐢⊿tring鐨勫瓧鑺傜爜杞崲錛岃繖縐嶆柟妗堥棶棰樻槸涓嶆柟渚匡紝鎴戜滑闇瑕佺牬鍧忓璞″皝瑁呮э紝榪涜瀛楄妭鐮佽漿鎹€?/p>

    銆銆榪樻湁涓縐嶆柟寮忔槸瀵笿2EE瀹瑰櫒榪涜緙栫爜璁劇疆錛屽鏋淛2EE搴旂敤緋葷粺鑴辯璇ュ鍣紝鍒欎細鍙戠敓涔辯爜錛岃屼笖鎸囧畾瀹瑰櫒閰嶇疆涓嶇鍚圝2EE搴旂敤鍜屽鍣ㄥ垎紱葷殑鍘熷垯銆?/p>

    銆銆鍦↗ava鍐呴儴榪愮畻涓紝娑夊強鍒扮殑鎵鏈夊瓧絎︿覆閮戒細琚漿鍖栦負UTF-8緙栫爜鏉ヨ繘琛岃繍綆椼傞偅涔堬紝鍦ㄨJava杞寲涔嬪墠錛屽瓧絎︿覆鏄粈涔堟牱鐨勫瓧絎﹂泦錛?Java鎬繪槸鏍規嵁鎿嶄綔緋葷粺鐨勯粯璁ょ紪鐮佸瓧絎﹂泦鏉ュ喅瀹氬瓧絎︿覆鐨勫垵濮嬬紪鐮侊紝鑰屼笖Java緋葷粺鐨勮緭鍏ュ拰杈撳嚭鐨勯兘鏄噰鍙栨搷浣滅郴緇熺殑榛樿緙栫爜銆?/p>

    銆銆鍥犳錛屽鏋滆兘緇熶竴Java緋葷粺鐨勮緭鍏ャ佽緭鍑哄拰鎿嶄綔緋葷粺3鑰呯殑緙栫爜瀛楃闆嗗悎錛屽皢鑳藉浣縅ava緋葷粺姝g‘澶勭悊鍜屾樉紺烘眽瀛椼傝繖鏄鐞咼ava緋葷粺姹夊瓧鐨勪竴涓師鍒欙紝浣嗘槸鍦ㄥ疄闄呴」鐩腑錛岃兘澶熸紜姄浣忓拰鎺у埗浣廕ava緋葷粺鐨勮緭鍏ュ拰杈撳嚭閮ㄥ垎鏄瘮杈冮毦鐨勩侸2EE涓紝鐢變簬娑夊強鍒板閮ㄦ祻瑙堝櫒鍜屾暟鎹簱絳夛紝鎵浠ヤ腑鏂囬棶棰樹貢鐮佹樉寰楅潪甯哥獊鍑恒?/p>

    銆銆J2EE搴旂敤紼嬪簭鏄繍琛屽湪J2EE瀹瑰櫒涓傚湪榪欎釜緋葷粺涓紝杈撳叆閫斿緞鏈夊緢澶氱錛氫竴縐嶆槸閫氳繃欏甸潰琛ㄥ崟鎵撳寘鎴愯姹傦紙request錛夊彂寰鏈嶅姟鍣ㄧ殑錛涚浜岀鏄氳繃鏁版嵁搴撹鍏ワ紱榪樻湁絎?縐嶈緭鍏ユ瘮杈冨鏉傦紝JSP鍦ㄧ涓嬈¤繍琛屾椂鎬繪槸琚紪璇戞垚Servlet錛孞SP涓父甯稿寘鍚腑鏂囧瓧絎︼紝閭d箞緙栬瘧浣跨敤javac鏃訛紝Java灝嗘牴鎹粯璁ょ殑鎿嶄綔緋葷粺緙栫爜浣滀負鍒濆緙栫爜銆傞櫎闈炵壒鍒寚瀹氾紝濡傚湪Jbuilder/eclipse涓彲浠ユ寚瀹氶粯璁ょ殑瀛楃闆嗐?/p>

    銆銆杈撳嚭閫斿緞涔熸湁鍑犵錛氱涓縐嶆槸JSP欏甸潰鐨勮緭鍑恒傜敱浜嶫SP欏甸潰宸茬粡琚紪璇戞垚Servlet錛岄偅涔堝湪杈撳嚭鏃訛紝涔熷皢鏍規嵁鎿嶄綔緋葷粺鐨勯粯璁ょ紪鐮佹潵閫夋嫨杈撳嚭緙栫爜錛岄櫎闈炴寚瀹氳緭鍑虹紪鐮佹柟寮忥紱榪樻湁杈撳嚭閫斿緞鏄暟鎹簱錛屽皢瀛楃涓茶緭鍑哄埌鏁版嵁搴撱?/p>

    銆銆鐢辨鐪嬫潵錛屼竴涓狫2EE緋葷粺鐨勮緭鍏ヨ緭鍑烘槸闈炲父澶嶆潅錛岃屼笖鏄姩鎬佸彉鍖栫殑錛岃孞ava鏄法騫沖彴榪愯鐨勶紝鍦ㄥ疄闄呯紪璇戝拰榪愯涓紝閮藉彲鑳芥秹鍙婂埌涓嶅悓鐨勬搷浣滅郴緇燂紝濡傛灉浠葷敱Java鑷敱鏍規嵁鎿嶄綔緋葷粺鏉ュ喅瀹氳緭鍏ヨ緭鍑虹殑緙栫爜瀛楃闆嗭紝榪欏皢涓嶅彲鎺у埗鍦板嚭鐜頒貢鐮併?/p>

    銆銆姝f槸鐢變簬Java鐨勮法騫沖彴鐗規э紝浣垮緱瀛楃闆嗛棶棰樺繀欏葷敱鍏蜂綋緋葷粺鏉ョ粺涓瑙e喅錛屾墍浠ュ湪涓涓狫ava搴旂敤緋葷粺涓紝瑙e喅涓枃涔辯爜鐨勬牴鏈姙娉曟槸鏄庣‘鎸囧畾鏁翠釜搴旂敤緋葷粺緇熶竴瀛楃闆嗐?/strong>

    銆銆鎸囧畾緇熶竴瀛楃闆嗘椂錛屽埌搴曟槸鎸囧畾ISO8859_1 銆丟BK榪樻槸UTF-8鍛紵

    銆銆錛?錛夊緇熶竴鎸囧畾涓篒SO8859_1錛屽洜涓虹洰鍓嶅ぇ澶氭暟杞歡閮芥槸瑗挎柟浜虹紪鍒剁殑錛屼粬浠粯璁ょ殑瀛楃闆嗗氨鏄疘SO8859_1錛屽寘鎷搷浣滅郴緇烲inux鍜屾暟鎹簱MySQL絳夈傝繖鏍鳳紝濡傛灉鎸囧畾Jive緇熶竴緙栫爜涓篒SO8859_1錛岄偅涔堝氨鏈変笅闈?涓幆鑺傚繀欏繪妸鎻★細

    銆銆寮鍙戝拰緙栬瘧浠g爜鏃舵寚瀹氬瓧絎﹂泦涓篒SO8859_1銆?/p>

    銆銆榪愯鎿嶄綔緋葷粺鐨勯粯璁ょ紪鐮佸繀欏繪槸ISO8859_1錛屽Linux銆?/p>

    銆銆鍦↗SP澶撮儴澹版槑錛?lt;%@ page contentType="text/html;charset=ISO8859_1" %>銆?/p>

    銆銆錛?錛夊鏋滅粺涓鎸囧畾涓篏BK涓枃瀛楃闆嗭紝涓婅堪3涓幆鑺傚悓鏍烽渶瑕佸仛鍒幫紝涓嶅悓鐨勬槸鍙兘榪愯鍦ㄩ粯璁ょ紪鐮佷負GBK鐨勬搷浣滅郴緇燂紝濡備腑鏂嘩indows銆?/p>

    銆銆緇熶竴緙栫爜涓篒SO8859_1鍜孏BK铏界劧甯︽潵緙栧埗浠g爜鐨勬柟渚匡紝浣嗘槸鍚勮嚜鍙兘鍦ㄧ浉搴旂殑鎿嶄綔緋葷粺涓婅繍琛屻備絾鏄篃鐮村潖浜咼ava璺ㄥ鉤鍙拌繍琛岀殑浼樿秺鎬э紝鍙湪涓瀹氳寖鍥村唴琛屽緱閫氥備緥濡傦紝涓轟簡浣垮緱GBK緙栫爜鍦╨inux涓婅繍琛岋紝璁劇疆Linux緙栫爜涓篏BK銆?/p>

    銆銆閭d箞鏈夋病鏈変竴縐嶉櫎浜嗗簲鐢ㄧ郴緇熶互澶栦笉闇瑕佽繘琛屼換浣曢檮鍔犺緗殑涓枃緙栫爜鏍規湰瑙e喅鏂規鍛紵

    銆銆灝咼ava/J2EE緋葷粺鐨勭粺涓緙栫爜瀹氫箟涓篣TF-8銆俇TF-8緙栫爜鏄竴縐嶅吋瀹規墍鏈夎璦鐨勭紪鐮佹柟寮忥紝鎯熶竴姣旇緝楹葷儲鐨勫氨鏄鎵懼埌搴旂敤緋葷粺鐨勬墍鏈夊嚭鍏ュ彛錛岀劧鍚庝嬌鐢║TF-8鍘燴滅粨鎵庘濆畠銆?/p>

    銆銆涓涓狫2EE搴旂敤緋葷粺闇瑕佸仛涓嬪垪鍑犳宸ヤ綔錛?/p>

    1. 寮鍙戝拰緙栬瘧浠g爜鏃舵寚瀹氬瓧絎﹂泦涓篣TF-8銆侸Builder鍜孍clipse閮藉彲浠ュ湪欏圭洰灞炴т腑璁劇疆銆?
    2. 浣跨敤榪囨護鍣紝濡傛灉鎵鏈夎姹傞兘緇忚繃涓涓猄ervlet鎺у埗鍒嗛厤鍣紝閭d箞浣跨敤Servlet鐨刦ilter鎵ц璇彞錛屽皢鎵鏈夋潵鑷祻瑙堝櫒鐨勮姹傦紙request錛夎漿鎹負UTF-8錛屽洜涓烘祻瑙堝櫒鍙戣繃鏉ョ殑璇鋒眰鍖呮牴鎹祻瑙堝櫒鎵鍦ㄧ殑鎿嶄綔緋葷粺緙栫爜錛屽彲鑳芥槸鍚勭褰㈠紡緙栫爜銆傚叧閿竴鍙ワ細
      request.setCharacterEncoding("UTF-8")銆?br />緗戜笂鏈夋filter鐨勬簮鐮侊紝Jdon妗嗘灦婧愮爜涓璫om.jdon.util.SetCharacterEncodingFilter
      闇瑕侀厤緗畐eb.xml 嬋媧昏Filter銆?
    3. 鍦↗SP澶撮儴澹版槑錛?lt;%@ page contentType="text/html;charset= UTF-8" %>銆?
    4. 鍦↗sp鐨刪tml浠g爜涓紝澹版槑UTF-8:
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    5. 璁懼畾鏁版嵁搴撹繛鎺ユ柟寮忔槸UTF-8銆備緥濡傝繛鎺YSQL鏃墮厤緗甎RL濡備笅錛?br />jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=UTF-8
      涓鑸暟鎹簱閮藉彲浠ラ氳繃綆$悊璁劇疆璁懼畾UTF-8
    6. 鍏朵粬鍜屽鐣屼氦浜掓椂鑳藉璁懼畾緙栫爜鏃跺氨璁懼畾UTF-8錛屼緥濡傝鍙栨枃浠訛紝鎿嶄綔XML絳夈?
    銆銆銆銆 銆銆

    銆銆浠ヤ笂璁ㄨ浜咼ava/J2EE鐨勪腑鏂囬棶棰樸傚鏋滄暣涓簲鐢ㄧ郴緇熸槸浠庡紑濮嬭繘琛屽紑鍙戯紝閭d箞緇熶竴鎸囧畾緙栫爜涓篣TF-8灝遍潪甯稿鏄撳仛鍒般傚鏋滄槸鍦ㄨ嫳鏂囨簮浠g爜鍩虹涓婁簩嬈″紑鍙戯紝閭d箞棣栧厛瑕佸皢鍘熸潵鐨勬簮浠g爜杞崲涓虹粺涓緙栫爜UTF-8錛岄偅涔堣繖縐嶈漿鎹㈠伐浣滀細甯︽潵涓瀹氱殑楹葷儲銆?/p>銆銆

    銆銆鏈変簡榪欎釜瑙e喅鏂規錛屾棤璁轟嬌鐢ㄤ粈涔堟鏋禨truts 鎴朖SF鎴栨湭鏉ュ嚭鐜扮殑Java鎶鏈紝緇熶竴鎴怳TF-8鐨勬柟妗堥兘涓嶄細鍑虹幇涔辯爜錛岀瑪鑰呬互鍓嶅湪Jsp/Servlet鏃跺氨鍩轟簬榪欎釜鍘熷垯錛屽悗鏉ヤ嬌鐢⊿truts絳夋鏋訛紝浠庢湭琚貢鐮佸洶鎵拌繃錛屽笇鏈涙湰鏂規鍏竷鍑烘潵渚涙洿澶氬垵瀛﹁呭垎浜紝鍑忓皯Java/J2EE鐨勭涓涓嫤璺檸錛屼篃閬垮厤閲囧彇涓浜涗復鏃惰В鍐蟲柟妗堛?br />

    ***********************************************************************************************************************
    聽 <filter> 聽
    聽 <filter-name>encodingFilter</filter-name> 聽
    聽 <filter-class> 聽
    聽 org.springframework.web.filter.CharacterEncodingFilter 聽
    聽 </filter-class> 聽
    聽 <init-param> 聽
    聽 <param-name>encoding</param-name> 聽
    聽 <param-value>UTF-8</param-value> 聽
    聽 </init-param> 聽
    聽 <init-param> 聽
    聽 <param-name>forceEncoding</param-name> 聽
    聽 <param-value>true</param-value> 聽
    聽 </init-param> 聽
    聽 </filter> 聽
    聽 聽
    聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 <filter-mapping> 聽
    聽 <filter-name>encodingFilter</filter-name> 聽
    聽 <servlet-name>action</servlet-name> 聽
    聽 </filter-mapping>


    ***********************************************************************************************

    hibernate+mysql鍐欏叆鏁版嵁搴撶殑涓枃鏄?b style="COLOR: black; BACKGROUND-COLOR: #a0ffff">涔辯爜錛屾庝箞瑙e喅錛燂紵


    hibernate.hbm.xml鍔犱笂灞炴?
    <property name=\"connection.useUnicode\">true</property>
    <property name=\"connection.characterEncoding\">UTF-8</property>

    mysql 鐨勯┍鍔ㄧ敤3.0.15浠ヤ笂鐗堟湰鐨?

    鍔犱釜Filter, 浣跨敤UTF-8瀛楃闆嗗氨鍙互浜?



    1.浣緼pplicationResources.properties鏀寔涓枃
    寤虹珛涓涓狝pplicationResources_ISO.properties鏂囦歡錛屾妸搴旂敤紼嬪簭鐢ㄧ殑message閮藉啓榪涘幓錛岀劧鍚庡湪dos涓嬫墽琛岃繖涓懡浠わ紝
    native2ascii聽-encoding聽gb2312聽ApplicationResources_ISO.properties聽ApplicationResources.properties
    榪欐牱灝變細灝咺SO緙栫爜鐨凙pplicationResources杞崲鎴怗B2312緙栫爜鐨勬牸寮忎簡錛屽悓鏃朵繚瀛樺埌ApplicationResources.properties.
    native2ascii榪欎釜宸ュ叿鏄痡dk鑷甫鐨勪竴涓笢涓滐紝鎵浠ュ鏋減ath閮借瀹氭紜氨鍙互鐩存帴榪愯浜嗭紝浣犲彲浠ュ湪$java_home$/bin涓嬫壘鍒頒粬銆?br />杞崲鍚庣殑涓枃綾諱技浜庤繖涓牱瀛?br />iso聽鏍煎紡涓嬄狅細tj.type=鍟嗗搧杞︾被鍨?br />gb2312鏍煎紡涓嬄狅細tj.type=\u5546\u54c1\u8f66\u7c7b\u578b
    鐒跺悗鍦╯truts-config.xml涓緗簲鐢ㄨ繖涓祫婧愭枃浠?br />聽<message-resources聽parameter=\"com.huahang.tj.ApplicationResources\"聽key=\"org.apache.struts.action.MESSAGE\"聽/>
    寮鍙慾sp鏃跺湪jsp鐨勫紑澶村啓涓?lt;%@聽page聽contentType=\"text/html;聽charset=gb2312\"聽%>錛屽皢瀛楃闆嗚緗垚gb2312灝卞彲浠ヤ簡銆?br />
    2.浣挎暟鎹簱鎿嶄綔鏀寔涓枃銆?br />鏁版嵁搴撴搷浣滄敮鎸佷腑鏂囦竴鐩磋鎴戞瘮杈冨ご鐥涳紝浣嗘槸鎰熻阿鍠勮В浜鴻。鍚戞垜鎺ㄨ崘浜唚ww.chinaxp.org錛岃繖涓綉绔欐槸鐢╯truts妗嗘灦寮鍙戠殑錛岃屼笖
    寮鏀炬簮鐮侊紝涓嬭澆浜嗘簮鐮佸悗鍙戠幇瀹冪殑涓枃澶勭悊寰楀緢濂斤紝闃呰閮ㄥ垎婧愮爜錛屾病鏈夊彂鐜頒粈涔堢壒孌婄殑瀛楃闆嗚漿鎹紝寰堢撼闂鳳紝鍋剁劧鐪嬪埌妤間笂緗戝弸
    鐣欒█鐭ラ亾鍘熸潵servlet鍙互緇熶竴璁劇疆瀛楃杞崲銆俢hinaxp.org灝辨槸榪欎箞鍋氱殑銆?br />鍦╳eb.xml涓姞涓?br />聽聽<filter>
    聽聽聽聽<filter-name>Set聽Character聽Encoding</filter-name>
    聽聽聽聽<filter-class>com.huahang.tj.struts.filters.SetCharacterEncodingFilter</filter-class>
    聽聽聽聽<init-param>
    聽聽聽聽聽聽<param-name>encoding</param-name>
    聽聽聽聽聽聽<param-value>GB2312</param-value>
    聽聽聽聽</init-param>
    聽聽聽聽<init-param>
    聽聽聽聽聽聽<param-name>ignore</param-name>
    聽聽聽聽聽聽<param-value>true</param-value>
    聽聽聽聽</init-param>
    聽聽</filter>
    聽聽<filter-mapping>
    聽聽聽聽<filter-name>Set聽Character聽Encoding</filter-name>
    聽聽聽聽<servlet-name>action</servlet-name>
    聽聽</filter-mapping>
    榪欓噷浼氭秹鍙婁竴涓猙ean,婧愮爜濡備笅錛?br />/*
    聽*聽XP聽Forum
    聽*聽聽聽聽
    聽*聽Copyright聽(c)聽2002-2003聽RedSoft聽Group.聽聽All聽rights聽reserved.
    聽*
    聽*/
    package聽com.huahang.tj.struts.filters;

    import聽javax.servlet.*;
    import聽java.io.IOException;

    /**
    聽*聽<p>Filter聽that聽sets聽the聽character聽encoding聽to聽be聽used聽in聽parsing聽the
    聽*聽incoming聽request,聽either聽unconditionally聽or聽only聽if聽the聽client聽did聽not
    聽*聽specify聽a聽character聽encoding.聽聽Configuration聽of聽this聽filter聽is聽based聽on
    聽*聽the聽following聽initialization聽parameters:</p>
    聽*聽<ul>
    聽*聽<li><strong>encoding</strong>聽-聽The聽character聽encoding聽to聽be聽configured
    聽*聽聽聽聽聽for聽this聽request,聽either聽conditionally聽or聽unconditionally聽based聽on
    聽*聽聽聽聽聽the聽<code>ignore</code>聽initialization聽parameter.聽聽This聽parameter
    聽*聽聽聽聽聽is聽required,聽so聽there聽is聽no聽default.</li>
    聽*聽<li><strong>ignore</strong>聽-聽If聽set聽to聽\"true\",聽any聽character聽encoding
    聽*聽聽聽聽聽specified聽by聽the聽client聽is聽ignored,聽and聽the聽value聽returned聽by聽the
    聽*聽聽聽聽聽<code>selectEncoding()</code>聽method聽is聽set.聽聽If聽set聽to聽\"false,
    聽*聽聽聽聽聽<code>selectEncoding()</code>聽is聽called聽<strong>only</strong>聽if聽the
    聽*聽聽聽聽聽client聽has聽not聽already聽specified聽an聽encoding.聽聽By聽default,聽this
    聽*聽聽聽聽聽parameter聽is聽set聽to聽\"true\".</li>
    聽*聽</ul>
    聽*
    聽*聽<p>Although聽this聽filter聽can聽be聽used聽unchanged,聽it聽is聽also聽easy聽to
    聽*聽subclass聽it聽and聽make聽the聽<code>selectEncoding()</code>聽method聽more
    聽*聽intelligent聽about聽what聽encoding聽to聽choose,聽based聽on聽characteristics聽of
    聽*聽the聽incoming聽request聽(such聽as聽the聽values聽of聽the聽<code>Accept-Language</code>
    聽*聽and聽<code>User-Agent</code>聽headers,聽or聽a聽value聽stashed聽in聽the聽current
    聽*聽user\'s聽session.</p>
    聽*
    聽*聽@author聽<a聽href=\"mailto:jwtronics@yahoo.com\">John聽Wong</a>
    聽*
    聽*聽@version聽$Id:聽SetCharacterEncodingFilter.java,v聽1.1聽2002/04/10聽13:59:27聽johnwong聽Exp聽$
    聽*/
    public聽class聽SetCharacterEncodingFilter聽implements聽Filter聽{

    聽聽聽聽//聽-----------------------------------------------------聽Instance聽Variables


    聽聽聽聽/**
    聽聽聽聽聽*聽The聽default聽character聽encoding聽to聽set聽for聽requests聽that聽pass聽through
    聽聽聽聽聽*聽this聽filter.
    聽聽聽聽聽*/
    聽聽聽聽protected聽String聽encoding聽=聽null;


    聽聽聽聽/**
    聽聽聽聽聽*聽The聽filter聽configuration聽object聽we聽are聽associated聽with.聽聽If聽this聽value
    聽聽聽聽聽*聽is聽null,聽this聽filter聽instance聽is聽not聽currently聽configured.
    聽聽聽聽聽*/
    聽聽聽聽protected聽FilterConfig聽filterConfig聽=聽null;


    聽聽聽聽/**
    聽聽聽聽聽*聽Should聽a聽character聽encoding聽specified聽by聽the聽client聽be聽ignored?
    聽聽聽聽聽*/
    聽聽聽聽protected聽boolean聽ignore聽=聽true;


    聽聽聽聽//聽---------------------------------------------------------聽Public聽Methods


    聽聽聽聽/**
    聽聽聽聽聽*聽Take聽this聽filter聽out聽of聽service.
    聽聽聽聽聽*/
    聽聽聽聽public聽void聽destroy()聽{

    聽聽聽聽聽聽聽聽this.encoding聽=聽null;
    聽聽聽聽聽聽聽聽this.filterConfig聽=聽null;

    聽聽聽聽}


    聽聽聽聽/**
    聽聽聽聽聽*聽Select聽and聽set聽(if聽specified)聽the聽character聽encoding聽to聽be聽used聽to
    聽聽聽聽聽*聽interpret聽request聽parameters聽for聽this聽request.
    聽聽聽聽聽*
    聽聽聽聽聽*聽@param聽request聽The聽servlet聽request聽we聽are聽processing
    聽聽聽聽聽*聽@param聽result聽The聽servlet聽response聽we聽are聽creating
    聽聽聽聽聽*聽@param聽chain聽The聽filter聽chain聽we聽are聽processing
    聽聽聽聽聽*
    聽聽聽聽聽*聽@exception聽IOException聽if聽an聽input/output聽error聽occurs
    聽聽聽聽聽*聽@exception聽ServletException聽if聽a聽servlet聽error聽occurs
    聽聽聽聽聽*/
    聽聽聽聽public聽void聽doFilter(ServletRequest聽request,聽ServletResponse聽response,
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽FilterChain聽chain)
    聽聽聽聽throws聽IOException,聽ServletException聽{

    聽聽聽聽聽聽聽聽//聽Conditionally聽select聽and聽set聽the聽character聽encoding聽to聽be聽used
    聽聽聽聽聽聽聽聽if聽(ignore聽||聽(request.getCharacterEncoding()聽==聽null))聽{
    聽聽聽聽聽聽聽聽聽聽聽聽String聽encoding聽=聽selectEncoding(request);
    聽聽聽聽聽聽聽聽聽聽聽聽if聽(encoding聽!=聽null)
    聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽request.setCharacterEncoding(encoding);
    聽聽聽聽聽聽聽聽}

    聽聽聽聽//聽Pass聽control聽on聽to聽the聽next聽filter
    聽聽聽聽聽聽聽聽chain.doFilter(request,聽response);

    聽聽聽聽}


    聽聽聽聽/**
    聽聽聽聽聽*聽Place聽this聽filter聽into聽service.
    聽聽聽聽聽*
    聽聽聽聽聽*聽@param聽filterConfig聽The聽filter聽configuration聽object
    聽聽聽聽聽*/
    聽聽聽聽public聽void聽init(FilterConfig聽filterConfig)聽throws聽ServletException聽{

    聽聽聽聽this.filterConfig聽=聽filterConfig;
    聽聽聽聽聽聽聽聽this.encoding聽=聽filterConfig.getInitParameter(\"encoding\");
    聽聽聽聽聽聽聽聽String聽value聽=聽filterConfig.getInitParameter(\"ignore\");
    聽聽聽聽聽聽聽聽if聽(value聽==聽null)
    聽聽聽聽聽聽聽聽聽聽聽聽this.ignore聽=聽true;
    聽聽聽聽聽聽聽聽else聽if聽(value.equalsIgnoreCase(\"true\"))
    聽聽聽聽聽聽聽聽聽聽聽聽this.ignore聽=聽true;
    聽聽聽聽聽聽聽聽else聽if聽(value.equalsIgnoreCase(\"yes\"))
    聽聽聽聽聽聽聽聽聽聽聽聽this.ignore聽=聽true;
    聽聽聽聽聽聽聽聽else
    聽聽聽聽聽聽聽聽聽聽聽聽this.ignore聽=聽false;

    聽聽聽聽}


    聽聽聽聽//聽------------------------------------------------------聽Protected聽Methods


    聽聽聽聽/**
    聽聽聽聽聽*聽Select聽an聽appropriate聽character聽encoding聽to聽be聽used,聽based聽on聽the
    聽聽聽聽聽*聽characteristics聽of聽the聽current聽request聽and/or聽filter聽initialization
    聽聽聽聽聽*聽parameters.聽聽If聽no聽character聽encoding聽should聽be聽set,聽return
    聽聽聽聽聽*聽<code>null</code>.
    聽聽聽聽聽*聽<p>
    聽聽聽聽聽*聽The聽default聽implementation聽unconditionally聽returns聽the聽value聽configured
    聽聽聽聽聽*聽by聽the聽<strong>encoding</strong>聽initialization聽parameter聽for聽this
    聽聽聽聽聽*聽filter.
    聽聽聽聽聽*
    聽聽聽聽聽*聽@param聽request聽The聽servlet聽request聽we聽are聽processing
    聽聽聽聽聽*/
    聽聽聽聽protected聽String聽selectEncoding(ServletRequest聽request)聽{

    聽聽聽聽聽聽聽聽return聽(this.encoding);

    聽聽聽聽}

    }//EOC
    鍔犱笂榪欎釜鍚庯紝鍦╝ction涓氨鍙互鐩存帴浠巉orm涓帴鏀秅b2312緙栫爜鐨勬暟鎹簡錛岃繑鍥炴椂鑷劧涔熸槸gb2312浜嗐?br />浣嗘槸榪欎釜濂藉儚闇瑕乻ervlet聽2.2浠ヤ笂鐨勫鍣?br />
    緇煎悎涓婇潰鐨勬柟娉曪紝鎴戣В鍐充簡struts涓殑涓枃闂錛岀幇鍦ㄨ繕娌″彂鐜版柊鐨勯棶棰樸?/font>



    SIMONE 2006-08-17 19:01 鍙戣〃璇勮
    ]]>Struts甯歌寮傚父淇℃伅鍜岃В鍐蟲柟娉?/title><link>http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64183.html</link><dc:creator>SIMONE</dc:creator><author>SIMONE</author><pubDate>Thu, 17 Aug 2006 10:57:00 GMT</pubDate><guid>http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64183.html</guid><wfw:comment>http://m.tkk7.com/wangxinsh55/comments/64183.html</wfw:comment><comments>http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64183.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/wangxinsh55/comments/commentRss/64183.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/wangxinsh55/services/trackbacks/64183.html</trackback:ping><description><![CDATA[ <p>浠ヤ笅鎵璇寸殑struts-config.xml鍜孉pplicationResources.properties絳夋枃浠跺悕鏄己鐪佹椂浣跨敤鐨勶紝濡傛灉浣犱嬌鐢ㄤ簡澶氭ā鍧楋紝鎴栨寚瀹氫簡涓嶅悓鐨勮祫婧愭枃浠跺悕縐幫紝榪欎簺鍚嶅瓧瑕佸仛鐩稿簲鐨勪慨鏀廣?/p> <p> <strong>1銆佲淣o bean found under attribute key XXX鈥?br /></strong>鍦╯truts-config.xml閲屽畾涔変簡涓涓狝ctionForm錛屼絾type灞炴ф寚瀹氱殑綾諱笉瀛樺湪錛宼ype灞炴х殑鍊煎簲璇ユ槸Form綾葷殑鍏ㄥ悕銆傛垨鑰呮槸錛屽湪Action鐨勫畾涔変腑錛宯ame鎴朼ttribute灞炴ф寚瀹氱殑ActionForm涓嶅瓨鍦ㄣ?br /></p> <p> <strong>2銆佲淐annot find bean聽XXX in any scope鈥?/strong> <br />鍦ˋction閲屼竴鑸細request.setAttribute()涓浜涘璞★紝鐒跺悗鍦ㄨ漿鍚戠殑jsp鏂囦歡閲岋紙鐢╰ag鎴杛equest.getAttribute()鏂規硶錛夊緱鍒拌繖浜涘璞″茍鏄劇ず鍑烘潵銆傝繖涓紓甯告槸璇磈sp瑕佸緱鍒頒竴涓璞★紝浣嗗墠闈㈢殑Action閲屽茍娌℃湁灝嗗璞¤緗埌request錛堜篃鍙互鏄痵ession銆乻ervletContext錛夐噷銆?br />鍙兘鏄悕瀛楅敊浜嗭紝璇鋒鏌sp閲岀殑tag鐨勪竴鑸槸name灞炴э紝鎴杇etAttribute()鏂規硶鐨勫弬鏁板鹼紱鎴栬呮槸Action閫昏緫鏈夐棶棰樻病鏈夋墽琛宻etAttribute()鏂規硶灝卞厛杞悜浜嗐?br />榪樻湁鍙﹀涓涓彲鑳斤紝綰補鏄痡sp鏂囦歡鐨勯棶棰橈紝渚嬪<logic:iterate>浼氭寚瀹氫竴涓猧d鍊鹼紝鐒跺悗鍦ㄥ驚鐜噷<bean:write>浣跨敤榪欎釜鍊間綔涓簄ame鐨勫鹼紝濡傛灉榪欎袱涓間笉鍚岋紝涔熶細鍑虹幇姝ゅ紓甯搞傦紙閮芥槸涓涓亾鐞嗭紝request閲屾病鏈夊搴旂殑瀵硅薄銆傦級<br /></p> <p> <strong>3銆佲淢issing message for key "XXX"鈥?/strong> <br />緙哄皯鎵闇鐨勮祫婧愶紝媯鏌pplicationResources.properties鏂囦歡閲屾槸鍚︽湁jsp鏂囦歡閲岄渶瑕佺殑璧勬簮錛屼緥濡傦細</p> <p>聽</p> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <div> <img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width>0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /> <span style="COLOR: #000000"><</span> <span style="COLOR: #000000">bean:message聽key</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">msg.name.prompt</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">/></span> </div> </div> <p>聽</p> <p>榪欒浠g爜浼氭壘msg.name.prompt璧勬簮錛屽鏋淎ppliationResources.properties閲屾病鏈夎繖涓祫婧愬氨浼氬嚭鐜版湰寮傚父銆傚湪浣跨敤澶氭ā鍧楁椂錛岃娉ㄦ剰鍦ㄦā鍧楃殑struts-config-xxx.xml閲屾寚瀹氳浣跨敤鐨勮祫婧愭枃浠跺悕縐幫紝鍚﹀垯褰撶劧浠涔堣祫婧愪篃鎵句笉鍒幫紝榪欎篃鏄竴涓緢瀹規槗鐘殑閿欒銆?/p> <p> <strong>4銆佲淣o getter method for property聽XXX of bean teacher鈥?/strong> <br />榪欐潯寮傚父淇℃伅璇村緱寰堟槑鐧斤紝jsp閲岃鍙栦竴涓猙ean鐨勫睘鎬у嚭鏉ワ紝浣嗚繖涓猙ean騫舵病鏈夎繖涓睘鎬с備綘搴旇媯鏌sp涓煇涓爣絳劇殑property灞炴х殑鍊箋備緥濡備笅闈唬鐮佷腑鐨刢ade搴旇鏀逛負code鎵嶅錛?/p> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <div> <img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width>0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /> <span style="COLOR: #000000"><</span> <span style="COLOR: #000000">bean:write聽name</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">teacher</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽property</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">cade</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽filter</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">true</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">/></span> </div> </div> <br /> <p> </p> <p> <strong>5銆佲淐annot find ActionMappings or ActionFormBeans collection鈥?br /></strong>寰呰В鍐熾?/p> <p> <strong>6銆佲淐annot retrieve mapping for action XXX鈥?br /></strong>鍦?jsp鐨?lt;form>鏍囩閲屾寚瀹歛ction='/XXX'錛屼絾榪欎釜Action騫舵湭鍦╯truts-config.xml閲岃緗繃銆?/p> <p> <strong>7銆丠TTP Status 404 - /xxx/xxx.jsp<br /></strong>Forward鐨刾ath灞炴ф寚鍚戠殑jsp欏甸潰涓嶅瓨鍦紝璇鋒鏌ヨ礬寰勫拰妯″潡錛屽浜庡悓涓妯″潡涓殑Action杞悜錛宲ath涓笉搴斿寘鍚ā鍧楀悕錛涙ā鍧楅棿杞悜錛岃浣忎嬌鐢╟ontextRelative="true"銆?/p> <p> <strong>8銆佹病鏈変換浣曞紓甯鎬俊鎭紝鏄劇ず絀虹櫧欏甸潰</strong> <br />鍙兘鏄疉ction閲屼嬌鐢ㄧ殑forward涓巗truts-config.xml閲屽畾涔夌殑forward鍚嶇О涓嶅尮閰嶃?br /></p> <p> <strong>9銆佲淭he element type "XXX" must be terminated by the matching end-tag "XXX".鈥?br /></strong>榪欎釜鏄痵truts-config.xml鏂囦歡鐨勬牸寮忛敊璇紝浠旂粏媯鏌ュ畠鏄惁鏄壇鏋勭殑xml鏂囦歡錛屽叧浜巟ml鏂囦歡鐨勬牸寮忚繖閲屽氨涓嶈禈榪頒簡銆?/p> <p> <strong>10銆佲淪ervlet.init() for servlet action threw exception鈥?/strong> <br />涓鑸嚭鐜拌繖縐嶅紓甯稿湪鍚庨潰浼氭樉紺轟竴涓叧浜嶢ctionServlet鐨勫紓甯稿爢鏍堜俊鎭紝鍏朵腑鎸囧嚭浜嗗紓甯稿叿浣撳嚭鐜板湪浠g爜鐨勫摢涓琛屻傛垜鏇劇粡閬囧埌鐨勪竴嬈℃彁紺哄涓嬶細</p> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <div> <img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width>0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /> <span style="COLOR: #000000">java.lang.NullPointerException<br /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width>0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />聽聽聽聽at聽org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:</span> <span style="COLOR: #000000">1003</span> <span style="COLOR: #000000">)<br /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width>0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" />聽聽聽聽at聽org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:</span> <span style="COLOR: #000000">955</span> <span style="COLOR: #000000">)<br /><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" onload="var image=new Image();image.src=this.src;if(image.width>0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" align="top" /><img src="http://www.cnblogs.com/Images/dot.gif" onload="var image=new Image();image.src=this.src;if(image.width>0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" /></span> </div> </div> <p> <br />涓鴻В鍐抽棶棰橈紝鍏堜笅杞絪truts鐨勬簮鐮佸寘錛岀劧鍚庡湪ActionServlet.java鐨勭1003琛屾彃鍏ユ柇鐐癸紝騫跺鍚勫彉閲忚繘琛岀洃瑙嗐傚緢涓漢錛屾垜绔熺劧鎶妔truts-config.xml鏂囦歡寮勪涪浜嗭紝鍥犳鍑虹幇浜嗕笂闈㈢殑寮傚父錛屽簲璇ユ槸鍜孋VS鍚屾鏃朵笉灝忓績鍒犻櫎鐨勩?/p> <p> <strong>11銆佲淩esources not defined for Validator鈥?/strong> <br />榪欎釜鏄埄鐢╒alidator鎻掍歡鍋氶獙璇佹椂鍙兘鍑虹幇鐨勫紓甯革紝榪欐椂浣犺媯鏌alidation.xml鏂囦歡錛岀湅閲岄潰浣跨敤鐨勮祫婧愭槸鍚︾‘瀹炴湁瀹氫箟錛宖orm鐨勫悕縐版槸鍚︽紜紝絳夌瓑銆?/p> <p>涓婇潰榪欎簺鏄垜鍦ㄧ敤Struts鍋氶」鐩椂閬囧埌榪囩殑闂錛屽叾涓竴浜涙浘鍥扮粫鎴戜笉灝戞椂闂達紝鍏跺疄澶ч儴鍒嗛兘鏄嚜宸變笉緇嗗績閫犳垚鐨勩傚笇鏈涜繖綃囨枃绔犺兘瀵逛綘鐨勫紑鍙戞湁鎵甯姪錛屽茍嬈㈣繋緇х畫琛ュ厖銆?br /><br />12.<span id="tr9ptth" class="top_title">Struts緙栬瘧涓嚭鐜扳渃annot find actionmappings or actionformbeans collection鈥濇彁紺虹殑鍘熷洜錛?br /></span></p> <ol> <li>Web.xml鏈垵濮嬪寲闂<br />灝戜簡涓涓?lt;load-on-startup>0</load-on-startup><br />榪欐牱寮濮嬫槸娌℃湁鍔犺澆榪欎釜綾伙紝灝辨病鏈夊垵濮嬪寲struts-config.xml錛屾墍浠ユ壘涓嶅埌<br />actionmappings or actionformbeans collection銆?br /></li> <li>struts-config.xml闂<br /></li> <li>jar鍖呬笉鍏ㄦ垨鐗堟湰涓嶅<br />涔熸湁鍙兘瀵艱嚧榪欎釜闂錛屼粠stuts渚嬪瓙閲岄潰鎷瘋繃鏉ュ氨濂戒簡銆俿truts1.1鑷甫鍏?0涓猨ar鍖呫?br /></li> <li>緙栬瘧闂<br />鏈夊彲鑳紸ction鍜孎ormbean娌℃湁緙栬瘧錛屼篃浼氭湁榪欎釜闂錛屾鏌ヤ竴涓嬫湁娌℃湁瀵瑰簲鐨刢lass鏂囦歡灝卞ソ銆俢lass璺緞涓嶅鍙兘涔熶細瀵艱嚧榪欎釜闂銆?br /></li> <li>鐗堟湰闂<br />鐢ㄧ殑servlet瀹瑰櫒鍜宻truts鐗堟湰涓嶅鎴栬繖涓や釜鐗堟湰鍗忚皟鏈夐棶棰樸?br />鍦ㄤ互涓婂嚑鏉¢兘涓嶈兘瑙e喅闂鐨勬儏鍐典笅錛屽彲鑳藉氨鏄増鏈殑闂浜嗭紝鎹釜楂樼増鏈瘯璇曞惂</li> </ol> <img src ="http://m.tkk7.com/wangxinsh55/aggbug/64183.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/wangxinsh55/" target="_blank">SIMONE</a> 2006-08-17 18:57 <a href="http://m.tkk7.com/wangxinsh55/archive/2006/08/17/64183.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://m.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://jldledu.com" target="_blank">最近中文字幕免费2019</a>| <a href="http://653349.com" target="_blank">成年人视频在线观看免费</a>| <a href="http://joob4s.com" target="_blank">亚洲国产日产无码精品</a>| <a href="http://wwwdd312.com" target="_blank">四虎在线免费播放</a>| <a href="http://22youjizz.com" target="_blank">久久av免费天堂小草播放</a>| <a href="http://xmmn77.com" target="_blank">亚洲国产美国国产综合一区二区</a>| <a href="http://jgc528.com" target="_blank">猫咪社区免费资源在线观看</a>| <a href="http://wwwly6080.com" target="_blank">人人公开免费超级碰碰碰视频 </a>| <a href="http://sd-ll.com" target="_blank">成年人视频在线观看免费</a>| <a href="http://guilinsix.com" target="_blank">九一在线完整视频免费观看</a>| <a href="http://777mecom.com" target="_blank">亚洲精品自在线拍</a>| <a href="http://41xjj.com" target="_blank">亚洲美女在线国产</a>| <a href="http://tzfzs.com" target="_blank">97性无码区免费</a>| <a href="http://abc17171.com" target="_blank">岛国精品一区免费视频在线观看</a>| <a href="http://783944.com" target="_blank">亚洲女人18毛片水真多</a>| <a href="http://km9c.com" target="_blank">亚洲一区AV无码少妇电影☆</a>| <a href="http://222222se.com" target="_blank">天天看片天天爽_免费播放</a>| <a href="http://wwwfac37.com" target="_blank">免费人成毛片动漫在线播放 </a>| <a href="http://paweax.com" target="_blank">亚洲精品国产日韩无码AV永久免费网 </a>| <a href="http://gift1town.com" target="_blank">无码人妻一区二区三区免费手机</a>| <a href="http://mm1131.com" target="_blank">最好2018中文免费视频</a>| <a href="http://513109.com" target="_blank">亚洲另类小说图片</a>| <a href="http://90hong.com" target="_blank">亚洲第一AAAAA片</a>| <a href="http://88bgbg.com" target="_blank">午夜亚洲国产成人不卡在线</a>| <a href="http://pengkaimjg.com" target="_blank">日本视频一区在线观看免费</a>| <a href="http://miya863.com" target="_blank">中文字幕免费在线播放</a>| <a href="http://kssijia.com" target="_blank">午夜亚洲国产理论片二级港台二级</a>| <a href="http://xfmkt.com" target="_blank">老色鬼久久亚洲AV综合</a>| <a href="http://meyume.com" target="_blank">亚洲乱码中文字幕手机在线 </a>| <a href="http://3838dydy.com" target="_blank">免费人成视频在线观看网站</a>| <a href="http://hssw1688.com" target="_blank">免费无码AV一区二区</a>| <a href="http://67f6.com" target="_blank">亚洲人成网站999久久久综合</a>| <a href="http://5656ys.com" target="_blank">国产av无码专区亚洲av桃花庵</a>| <a href="http://gujingyuye.com" target="_blank">国产免费久久精品久久久</a>| <a href="http://gxshenquan.com" target="_blank">麻豆视频免费观看</a>| <a href="http://www8x5188x.com" target="_blank">久草视频在线免费看</a>| <a href="http://317777aa.com" target="_blank">久久精品免费网站网</a>| <a href="http://556228.com" target="_blank">黄页网站在线免费观看</a>| <a href="http://wuiso.com" target="_blank">亚洲爆乳无码精品AAA片蜜桃</a>| <a href="http://nuosheying.com" target="_blank">亚洲午夜电影在线观看</a>| <a href="http://www65axax.com" target="_blank">久久国产亚洲高清观看</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>