锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲v高清理论电影,日本亚洲欧美色视频在线播放,亚洲电影日韩精品http://www.tkk7.com/wansong/category/45576.htmlwansongzh-cnThu, 23 Dec 2010 18:52:26 GMTThu, 23 Dec 2010 18:52:26 GMT60jquery閫氳繃struts2璇鋒眰錛岃繑鍥瀓son鏁版嵁錛屽湪jsp欏甸潰褰㈡垚浜岀駭鑱斿姩涓嬫媺鍒楄〃http://www.tkk7.com/wansong/articles/341344.htmlw@ns0ngw@ns0ngWed, 22 Dec 2010 13:40:00 GMThttp://www.tkk7.com/wansong/articles/341344.htmlhttp://www.tkk7.com/wansong/comments/341344.htmlhttp://www.tkk7.com/wansong/articles/341344.html#Feedback0http://www.tkk7.com/wansong/comments/commentRss/341344.htmlhttp://www.tkk7.com/wansong/services/trackbacks/341344.html

w@ns0ng 2010-12-22 21:40 鍙戣〃璇勮
]]>
struts2 json jquery 闆嗘垚璇﹁Вhttp://www.tkk7.com/wansong/articles/340943.htmlw@ns0ngw@ns0ngFri, 17 Dec 2010 00:02:00 GMThttp://www.tkk7.com/wansong/articles/340943.htmlhttp://www.tkk7.com/wansong/comments/340943.htmlhttp://www.tkk7.com/wansong/articles/340943.html#Feedback0http://www.tkk7.com/wansong/comments/commentRss/340943.htmlhttp://www.tkk7.com/wansong/services/trackbacks/340943.htmljquery.xml2json.js    


struts2 json jquery 闆嗘垚璇﹁В
鏂囩珷鍒嗙被:Web鍓嶇
1.      浠庝互涓嬬綉鍧http://code.google.com/p/jsonplugin/downloads/list涓嬭澆JSON鎻掍歡鐨凧AR鍖咃紙鏂扮増鏈槸0.32錛夛紝騫跺姞鍒板伐紼嬬殑鐩稿簲鐩綍涓嬨備粠濡備笅緗戝潃http://docs.jquery.com/Downloading_jQuery涓嬭澆jquery鎵闇鏂囦歡銆?寤鴻涓嬭澆紼沖畾鐗堟湰錛屼笉鐒朵細鍑虹幇鑾悕鍏跺鐨勯敊璇?
2.      閰嶇疆鐩稿簲鐨剎ml鏂囦歡錛屼負ajax璇鋒眰鎻愪緵鏁版嵁錛?
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <package name="sajax" extends="json-default" namespace="/book">
        <action name="getAjaxBookChannelList" method="getAjaxBookChannelList" class="bookChannelAction">
            <result type="json" />
        </action>
        <action name="getAjaxBookCategoryListByChannelID" method="getAjaxBookCategoryListByChannelID" class="bookChannelAction">
            <result type="json" />
        </action>
    </package>
</struts>
閰嶇疆鏈変袱澶勪笌閫氬父鐨刟ction閰嶇疆涓嶅悓錛屼竴澶勬槸鎵╁睍浜唈son-default錛?json-default”鏄湪jsonplugin-0.30.jar鍖呴噷鐨剆truts-plugin.xml涓畾涔夌殑錛屾枃浠跺唴瀹瑰涓嬶細
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <package name="json-default" extends="struts-default">
        <result-types>
            <result-type name="json" class="com.googlecode.jsonplugin.JSONResult"/>
        </result-types>
        <interceptors>
            <interceptor name="json" class="com.googlecode.jsonplugin.JSONInterceptor"/>
        </interceptors>
    </package>
</struts>

鍙︿竴澶勬槸瀹氫箟浜嗚繑鍥炵被鍨嬩負json<result type="json" />錛屼細灝唕esponse涓殑榪斿洖鏁版嵁杞寲涓簀son瀵硅薄銆?
3錛庡湪Action涓殑瀹氫箟銆傚畾涔夎繑鍥炲璞★紝騫舵坊鍔爂et錛宻et鏂規硶銆傝繑鍥炵殑鏁版嵁鍙互鏍規嵁闇瑕佹牸寮忔垚json褰㈠紡(json鏍煎紡濡倇1:test,2:test})錛屾瘮濡備負浜岀駭鍒楄〃鎻愪緵濉厖鍐呭鐨勭殑鏁版嵁錛屽湪欏甸潰闇瑕佽繘琛岄亶鍘嗭紝鍋氭垚json褰㈠紡鐨勶紝鍦ㄩ〉闈㈤亶鍘嗘椂涔熶細姣旇緝鏂逛究銆侫ction浠g爜錛堥儴鍒嗭級濡備笅錛?
   
    public String getAjaxBookChannelList() {
       StringBuffer sb = new StringBuffer();
       bookChannelList = bookService.getBookChannelList();
       if (bookChannelList.size() > 0) {
           int j = bookChannelList.size();
           sb.append("{");
           for (int i = 0; i < j; i++) {
              BookChannel bc = (BookChannel) bookChannelList.get(i);
              sb.append(bc.getId());
              sb.append(":");
              sb.append("\"");
              sb.append(bc.getName());
              sb.append("\"");
              if (i != (j - 1))
                  sb.append(",");
           }
           sb.append("}");
       }

       strAjaxChannel = sb.toString();//榪斿洖鐨勬暟鎹?

       return Action.SUCCESS;
    }


4欏甸潰鎿嶄綔銆侸query涓凡緇忔彁渚涘嚑渚沘jax璇鋒眰鐨勬柟娉曪紝濡傛灉榪斿洖鐨勬槸json瀵硅薄錛屼嬌鐢╦Query.getJSON(url,[data],[callback])浼氭瘮杈冩柟渚匡紝

jQuery.getJSON(url,[data],[callback]) 閫氳繃 HTTP GET 璇鋒眰杞藉叆 JSON 鏁版嵁銆?

榪斿洖鍊?
XMLHttpRequest

鍙傛暟
url (String) : 鍙戦佽姹傚湴鍧銆?
data (Map) : (鍙? 寰呭彂閫?Key/value 鍙傛暟銆?
callback (Function) : (鍙? 杞藉叆鎴愬姛鏃跺洖璋冨嚱鏁般?

鍙傛暟閮ㄥ垎錛屾祻瑙堝櫒鐨勭紦瀛樻槸浠rl涓烘爣璇嗙殑錛屽鏋渦rl鐩稿悓浼氫嬌鐢ㄧ紦瀛樹腑鐨勬暟鎹紝濡傛灉涓嶆兂浣跨敤緙撳瓨錛屽彲浠ュ湪鍙傛暟涓姞鍏ヤ竴涓殢鏈烘暟銆?

jQuery.each(obj,callback)
閫氱敤渚嬮亶鏂規硶錛屽彲鐢ㄤ簬渚嬮亶瀵硅薄鍜屾暟緇?
鍙傛暟
object (Object) : 闇瑕佷緥閬嶇殑瀵硅薄鎴栨暟緇勩?
callback (Function) : (鍙? 姣忎釜鎴愬憳/鍏冪礌鎵ц鐨勫洖璋冨嚱鏁般?
鍥炶皟鍑芥暟鎷ユ湁涓や釜鍙傛暟錛氱涓涓負瀵硅薄鐨勬垚鍛樻垨鏁扮粍鐨勭儲寮曪紝絎簩涓負瀵瑰簲鍙橀噺鎴栧唴瀹廣?
Jquery鎿嶄綔涓嬫媺鍒楄〃娣誨姞閫夐」鐨勬柟娉曚負: $(“# categoryId”)[0].options.add(option);

欏甸潰浠g爜濡備笅錛堥儴鍒嗭級錛?
<. language="." type="text/." src="/.s/jquery-1.2.2.js"></.>
<. language=".">
       function fillChannel(id){
              var url = "/book/getAjaxBookChannelList.action";
              $.getJSON(url,{ran:Math.random()},function(json){
                     if(json.strAjaxChannel.length > 0){
                            var obj = .('(' + json.strAjaxChannel + ')');
                            $.each(obj,function(i,n){
                          option = new Option(n,i);
                          if(i==id)option.selected=true;
                         document.getElementById("channellistId").options.add(option);
                      });
                      option = new Option("鍏ㄩ儴棰戦亾",999);
                      if(id == 999)option.selected=true;
                      document.getElementById("channellistId").options.add(option); 
                  }
               else{
                           option = new Option("鏆傛棤棰戦亾");
                           document.getElementById("channellistId").options.add(option);
                  }
                     }
              );    
       }
       function fillCategory(chid,bid){
              document.getElementById("categoryId").options.length=1;
              var url = "/book/getAjaxBookCategoryListByChannelID.action";
              var cid = 0;
              if(chid > 0){
                     cid = chid;
              }
              else{
                     cid = document.getElementById("channellistId").value;
              }
              $.getJSON(url,{channelID:cid,ran:Math.random()}, function(json){
        //鍙傛暟涓洪閬揑D鍙婇殢鏈烘暟錛宖unction(json)涓哄洖璋冨嚱鏁幫紝鍏朵腑json涓哄彇鍒扮殑榪斿洖鏁版嵁
                       if(json.strAjaxCategory.length > 0){
                                   var obj = .('(' + json.strAjaxCategory + ')');//灝唈son鏂囨湰杞寲涓簀son瀵硅薄錛屼互渚夸簬閬嶅巻
                                   $.each(obj,function(i,n){  //jquery涓殑閬嶅巻鏂規硶錛?
                                 option = new Option(n,i);
                                 if(i==bid)option.selected=true;
                                document.getElementById("categoryId").options.add(option);
                             });
                                  option = new Option("鍏ㄩ儴鍒嗙被","-3");
                                  if(bid ==-3)option.selected=true;
                                  document.getElementById("categoryId").options.add(option);
                                  //jquery鐨勬柟娉曚負:$(“# categoryId”)[0].options.add(option);
                  }
                  else{
                           if(cid == 999){
                                  option = new Option("鍏ㄩ儴鍒嗙被","-1");
                                  document.getElementById("categoryId").options.add(option);                              
                           }
                           else{
                                  option = new Option("鏆傛棤鍒嗙被");
                                  document.getElementById("categoryId").options.add(option);
                           }
                  }
                     }
              );           
       }

       function fillSelect(chid,cid){
              fillChannel(chid);
              fillCategory(chid,cid);
       }
</.>
<body <s:if test="bookCategory.bookchannelId >0">onLoad="fillSelect(<s:property value="bookCategory.bookchannelId"/>,<s:property value="bookCategory.id"/>);"</s:if><s:if test="bookCategory==null">onLoad="fillChannel(0);"</s:if>>

浣滃搧綾誨埆
         <select name="channellistId" id="channellistId" onChange="fillCategory(<s:if test="bookCategory.bookchannelId >0">0,</s:if><s:property value="categoryId"/>);"><option>閫夋嫨棰戦亾</option></select>
         <select name="categoryId" id="categoryId"><option>閫夋嫨鍒嗙被</option></select>


鐩存帴璁塊棶http://manager.17k.com/book/getAjaxBookChannelList.action
寰楀埌濡備笅鍐呭錛?
{"ajaxBookCategoryListByChannelID":"success","ajaxBookChannelList":"success","bcID":0,"bchID":0,"bookCategory":null,"bookCategoryAllList":null,"bookCategoryByChannelID":"success","bookCategoryByID":null,"bookCategoryList":null,"bookCategoryListModel":null,"bookChannel":null,"bookChannelList":[{"createdate":"2008-07-09T10:23:36","id":1,"name":"鐣呴攢緇忓吀","prefix":"changxiao","status":0},{"createdate":"2008-07-09T10:24:03","id":2,"name":"鐜勫夠濂囧夠","prefix":"yy","status":0},{"createdate":"2008-07-09T10:24:25","id":3,"name":"閮藉競濞變箰","prefix":"dushi","status":0},{"createdate":"2008-07-09T10:24:38","id":4,"name":"鍘嗗彶鍐涗簨","prefix":"ss","status":0},{"createdate":"2008-07-09T10:24:54","id":5,"name":"濂蟲ф椂灝?,"prefix":"nvxing","status":0},{"createdate":"2008-07-09T10:25:11","id":6,"name":"娓告垙绔炴妧","prefix":"dongman","status":0},{"createdate":"2008-07-09T10:25:24","id":7,"name":"鎭愭栫伒寮?,"prefix":"kongbu","status":0},{"createdate":"2008-07-09T10:25:35","id":8,"name":"鏂囧寲紺劇","prefix":"www","status":0},{"createdate":"2008-07-09T10:25:46","id":9,"name":"緇忕鍔卞織","prefix":"www","status":0}],"channelID":0,"currentPage":0,"info":"","msg":"","pageSize":0,"srcID":0,"strAjax":"","strAjaxCategory":"","strAjaxChannel":"{1:\"鐣呴攢緇忓吀\",2:\"鐜勫夠濂囧夠\",3:\"閮藉競濞變箰\",4:\"鍘嗗彶鍐涗簨\",5:\"濂蟲ф椂灝歕",6:\"娓告垙绔炴妧\",7:\"鎭愭栫伒寮俓",8:\"鏂囧寲紺劇\",9:\"緇忕鍔卞織\"}","tarID":0,"theBookCategory":"success","theBookChannel":"success","toID":0}




鍏充簬jsonplugin搴忓垪鍖栫殑鍑犵偣錛?
a.瀵逛簬涓嶆兂琚簭鍒楀寲鐨勫睘鎬э紝鍙互鍦ㄤ粬鐨刧et鏂規硶鍓嶅姞娉ㄩ噴錛?nbsp;     @JSON(serialize=false)
b.瀵逛簬鎯蟲敼鍙榡son緇撴灉灞炴у悕縐扮殑錛屽彲浠ュ湪浠栫殑get鏂規硶鍓嶅姞娉ㄩ噴@JSON(name="灞炴у悕")
c. 甯︽湁transient淇グ絎︿笌娌℃湁Getter鏂規硶鐨勫瓧孌碉紙field錛夐兘涓嶄細琚覆琛屽寲涓篔SON銆?


w@ns0ng 2010-12-17 08:02 鍙戣〃璇勮
]]>
OGNL practicehttp://www.tkk7.com/wansong/articles/336339.htmlw@ns0ngw@ns0ngThu, 28 Oct 2010 00:26:00 GMThttp://www.tkk7.com/wansong/articles/336339.htmlhttp://www.tkk7.com/wansong/comments/336339.htmlhttp://www.tkk7.com/wansong/articles/336339.html#Feedback0http://www.tkk7.com/wansong/comments/commentRss/336339.htmlhttp://www.tkk7.com/wansong/services/trackbacks/336339.html
http://www.opensymphony.com/ognl/
http://www.opensymphony.com/ognl/api

Ognl.getValue("#root.{? #this.parentId == "
     + userOrganId + "}",
     Constant.AllORGANS);

w@ns0ng 2010-10-28 08:26 鍙戣〃璇勮
]]>
struts2 struts2 姣旇緝http://www.tkk7.com/wansong/articles/334981.htmlw@ns0ngw@ns0ngWed, 13 Oct 2010 00:33:00 GMThttp://www.tkk7.com/wansong/articles/334981.htmlhttp://www.tkk7.com/wansong/comments/334981.htmlhttp://www.tkk7.com/wansong/articles/334981.html#Feedback0http://www.tkk7.com/wansong/comments/commentRss/334981.htmlhttp://www.tkk7.com/wansong/services/trackbacks/334981.html

w@ns0ng 2010-10-13 08:33 鍙戣〃璇勮
]]>
struts 1 validatehttp://www.tkk7.com/wansong/articles/332660.htmlw@ns0ngw@ns0ngWed, 22 Sep 2010 14:11:00 GMThttp://www.tkk7.com/wansong/articles/332660.htmlhttp://www.tkk7.com/wansong/comments/332660.htmlhttp://www.tkk7.com/wansong/articles/332660.html#Feedback0http://www.tkk7.com/wansong/comments/commentRss/332660.htmlhttp://www.tkk7.com/wansong/services/trackbacks/332660.html <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
    </plug-in>
   


validation.xml:::::::::::::
<formset>
        <!-- An example form -->
        <form name="crudForm">
            <field property="name" depends="required">
                <arg key="crudform.name"/>
            </field>
        </form>
    </formset>

jsp::::::::::

<html:javascript formName="crudForm" dynamicJavascript="true" staticJavascript="true"/>

<div id="crudDetailDialog">
 <html:form action="/save.do" method="POST" styleId="crudForm" >
  <div id="crudDetailValidationMessages"><html:errors/></div>
  
  CrudId:<html:text property="crudId" />
  Name: <html:text property="name" />
  
  <input name="submit" type="submit" value='login' >
 </html:form>
</div>


form:::::::::::::::::::::::
CRUDForm extends ValidatorForm {

w@ns0ng 2010-09-22 22:11 鍙戣〃璇勮
]]>
struts 1 鏍¢獙http://www.tkk7.com/wansong/articles/332659.htmlw@ns0ngw@ns0ngWed, 22 Sep 2010 14:08:00 GMThttp://www.tkk7.com/wansong/articles/332659.htmlhttp://www.tkk7.com/wansong/comments/332659.htmlhttp://www.tkk7.com/wansong/articles/332659.html#Feedback0http://www.tkk7.com/wansong/comments/commentRss/332659.htmlhttp://www.tkk7.com/wansong/services/trackbacks/332659.html http://lucky16.javaeye.com/blog/450144
http://www.javaeye.com/topic/154151

濡傝繖鏍風殑500閿欒錛歂o input attribute for mapping path.  Validator瑕佹眰欏甸潰鍋氶獙璇?
瑙e喅鍔炴硶涓:
鍦╯truts_config.xml閲岀殑<action閲屽姞鍏nput
瑙e喅鍔炴硶浜?
鎶妔truts_config.xml閲岀殑<action閲岀殑validator鏀規垚false



Struts浣滀負涓涓笉鍋滃彂灞曠殑寮婧愰」鐩紝鍦ㄩ〉闈㈡牎楠岃繖涓鍧楅噰鐢ㄤ簡Jakarta鐨凜ommons欏圭洰鐨刅alidate錛岀粨鍚圫truts鐨凪VC浣撶郴錛?br /> 鐢ㄨ搗鏉ョ‘瀹炰笉閿欍傚緩璁牎楠岃繖閮ㄥ垎鍦ㄥ畬鎴恓sp鍚庡姞鍏ャ?br /> 鍘熺悊錛歋truts鐨勯〉闈㈡牎楠屽垎涓ょ鏂規硶錛屼竴縐嶆槸鍓嶅彴鐢熸垚Javascript錛屼竴縐嶆槸鍚庡彴class銆?br />       鑰屽嚭閿欎俊鎭搴旂殑涔熸湁涓ょ鏄劇ず鏂規硶錛屼竴縐嶆槸寮瑰嚭娑堟伅妗嗭紝涓縐嶆槸鍦ㄥ師欏甸潰鏄劇ず銆?br />       鎴戜釜浜烘瘮杈冨枩嬈㈠脊鍑烘秷鎭榪欑錛屽洜涓哄彲浠ュ皢鐒︾偣緗埌鍑洪敊鐨刦ield涓?br />       鎵浠ユ垜渚ч噸浠嬬粛濡備綍瀹炵幇榪欑銆?br />       璇鋒寜涓嬪垪姝ラ涓姝ヤ竴姝ヨ繘琛岋紝榪涜鐨勬椂鍊欐濊冨畠鐨勫仛娉曘?br />      
1     灝哠truts鎵闇lib鍔犲叆鍒伴」鐩甽ib璺緞鎴栨湇鍔″櫒鐨刲ib璺緞
      Struts1.1闇瑕佸涓媗ib錛歴truts-legacy.jar struts.jar jakarta-oro.jar commons-validator.jar
      commons-logging.jar commons-lang.jar commons-fileupload.jar commons-digester.jar commons-collections.jar
      commons-beanutils.jar(鍙互鐪嬪埌Struts1.1鐢ㄤ簡寰堝Commons欏圭洰鐨勪笢涓?
2     灝嗕笅杞界殑Struts1.1鐨勫寘涓殑webapps\struts-validator.war 涓殑validation.xml鍜寁alidator-rules.xml
      鎷峰埌欏圭洰鐨刉EB-INF璺緞
      浠旂粏鐮旂┒涓涓嬭繖涓や釜鏂囦歡錛屽彲浠ョ湅鍒皏alidator-rules.xml鏄彁渚涗竴浜涘父鐢ㄧ殑validation瑙勫垯銆?br />       鐩墠鎻愪緵浜唕equired錛宺equiredif,minlength,maxlength,mask,byte,short,integer,long,float,
      double,date,range,intRange,floatRange,creditCard,email,
      鎴戠湅浜嗕竴涓嬶紝鍙湁mask涓嶇煡閬撳叿浣撴槸騫插暐鐨勶紝鍏朵粬鏈涙枃鐢熶箟銆?鑷充簬濡備綍DIY涓鏉¤嚜宸辯殑rule錛屼亢榪樹笉浼?
      閲嶅ご鎴忔潵浜嗭紝淇敼validation.xml銆傚彲浠ョ湅涓涓媣alidation.xml緇撴瀯
validation.xml錛?nbsp;    
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE form-validation PUBLIC
          "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
          "

<form-validation>
   <global>
      <constant>
        <constant-name>phone</constant-name>
        <constant-value>^\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$</constant-value>
      </constant>
      <constant>
        <constant-name>zip</constant-name>
        <constant-value>^\d{5}\d*$</constant-value>
      </constant>
   </global>
   <formset>
      <constant>
        <constant-name>zip</constant-name>
        <constant-value>^\d{5}(-\d{4})?$</constant-value>
      </constant>

      <form    name="registrationForm">
         <field    property="firstName"
             depends="required,mask,minlength">
               <arg0 key="registrationForm.firstname.displayname"/>
               <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                     <var>
                       <var-name>mask</var-name>
                       <var-value>^\w+$</var-value>
                     </var>
                     <var>
                       <var-name>minlength</var-name>
                       <var-value>5</var-value>
                     </var>
         </field>
        ..........
      
      鐩鎬俊澶у浠旂粏涓鐪嬪氨鏄庣櫧浜?棣栧厛錛屽彲浠ュ畾涔変竴浜涚敤姝e垯琛ㄨ揪寮忚〃紺虹殑瑙勫垯錛岃繖浜涜鍒欒繕鍒嗗叏灞鍜屽眬閮ㄣ?br />       榪欐牱灝卞彲浠IY涓浜涘彲浠ョ敤姝e垯琛ㄨ揪寮忚〃紺虹殑瑙勫垯浜嗭紝渚嬪涓嬮潰灝卞叿浣撶敤鍒頒簡鑷畾涔夌殑瑙勫垯:phone銆?br />       ...
   <global>
      <constant>
        <constant-name>phone</constant-name>
        <constant-value>^\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$</constant-value>
      </constant>
   </global>
   ...  
      <field    property="mobile"
             depends="mask">
               <arg0 key="registrationForm.mobile.displayname"/>
                     <var>
                       <var-name>mask</var-name>
                       <var-value>${phone}</var-value>
                     </var>
      </field>
   ...
      榪欎笅涔熸槑鐧絤ask鐨勪綔鐢ㄤ簡錛屽師鏉ュ畠鏄笓闂ㄧ敤浜庤嚜瀹氫箟瑙勫垯錛?br />       鐒跺悗灝卞彲浠ユ坊鍔犻渶瑕佸姞validation鐨刦ield浜嗭紝鏍煎紡濡備笅錛?br />       <formset>
      <form name="registrationForm">
         <field    property="firstName"
             depends="required,mask,minlength">
               <arg0 key="registrationForm.firstname.displayname"/>
               <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                     <var>
                       <var-name>mask</var-name>
                       <var-value>^\w+$</var-value>
                     </var>
                     <var>
                       <var-name>minlength</var-name>
                       <var-value>5</var-value>
                     </var>
         </field>
      </form>
      </formset>
     
3     灝嗛渶瑕佸姞validation鐨刦ormbean鍏ㄩ儴鏀規垚 extends ValidatorForm
4     鍦╯truts-config.xml鏂囦歡涓姞鍏ヤ竴孌典唬鐮?lt;plug-in></plug-in>錛屼綅緗涓嬶細
......
    <action name="performanceSearchForm" path="/performanceRptAction" scope="request" type="com.hp.elog2.action.report.PerformanceRptAction">
      <forward name="success" path="/FinalRpt.jsp" redirect="false" />
    </action>
  </action-mappings>
  <message-resources parameter="ApplicationResources" />
  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
  </plug-in>
</struts-config>

5     鍦ˋpplicationResources.properties鏂囦歡涓姞鍏ュ涓嬪唴瀹?

# Errors
errors.header=Validation Error
errors.required={0} is required.
errors.minlength={0} can not be less than {1} characters.
errors.maxlength={0} can not be greater than {1} characters.
errors.invalid={0} is invalid.
errors.byte={0} must be an byte.
errors.short={0} must be an short.
errors.integer={0} must be an integer.
errors.long={0} must be an long.
errors.float={0} must be an float.
errors.double={0} must be an double.
errors.date={0} is not a date.
errors.range={0} is not in the range {1} through {2}.
errors.creditcard={0} is not a valid credit card number.
errors.email={0} is an invalid e-mail address.
      
      涓旀敞鎰忓湪淇敼validation.xml鏃訛紝濡?br />        <arg0 key="registrationForm.firstname.displayname"/>
      鍒橝pplicationResources.properties涓鏈夊搴旂殑 registrationForm.firstname.displayname 鍊箋?br />       榪欏氨鍙互瀹炵幇鍑洪敊淇℃伅鏈湴鍖栥?/p>

6     淇敼瑕佸姞validation鐨刯sp鏂囦歡銆備袱澶勶細
        1 鍦ㄩ〉闈㈢殑form鏍囩涓姞鍏nsubmit浜嬩歡
        <html:form action="registration" onsubmit="return validateRegistrationForm(this);">
        2 鍦?lt;/body>涔嬪墠鍔犲叆涓孌典唬鐮侊紝鍐呭濡備笅錛?br />         <html:javascript formName="registrationForm"/>
        榪欐浠g爜浼氳嚜鍔ㄧ敓鎴愪笂闈㈢殑validateRegistrationForm(this)鍑芥暟



w@ns0ng 2010-09-22 22:08 鍙戣〃璇勮
]]>
Struts2 鍏充簬OGNL鐨?#$鐨勫簲鐢?/title><link>http://www.tkk7.com/wansong/articles/326925.html</link><dc:creator>w@ns0ng</dc:creator><author>w@ns0ng</author><pubDate>Fri, 23 Jul 2010 04:32:00 GMT</pubDate><guid>http://www.tkk7.com/wansong/articles/326925.html</guid><wfw:comment>http://www.tkk7.com/wansong/comments/326925.html</wfw:comment><comments>http://www.tkk7.com/wansong/articles/326925.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/wansong/comments/commentRss/326925.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/wansong/services/trackbacks/326925.html</trackback:ping><description><![CDATA[http://hi.baidu.com/zhouhwbuaa/blog/item/b9b23bfbd478ab106c22eb0e.html<br /> <br /> http://wallboy.javaeye.com/blog/513096  <a >OGNL琛ㄨ揪寮忚璦浠嬬粛 </a><br /> <br /> <br /> 璁塊棶OGNL涓婁笅鏂囧拰Action涓婁笅鏂囷紝#鐩稿綋浜嶢ctionContext.getContext()錛涗笅琛ㄦ湁鍑犱釜ActionContext涓湁鐢ㄧ殑灞炴э細   鍚嶇О 浣滅敤 渚嬪瓙 <br /> parameters 鍖呭惈褰撳墠HTTP璇鋒眰鍙傛暟鐨凪ap #parameters.id[0]浣滅敤鐩稿綋浜巖equest.getParameter("id") <br /> request 鍖呭惈褰撳墠HttpServletRequest鐨勫睘鎬э紙attribute)鐨凪ap #request.userName鐩稿綋浜巖equest.getAttribute("userName") <br /> session 鍖呭惈褰撳墠HttpSession鐨勫睘鎬э紙attribute錛夌殑Map #session.userName鐩稿綋浜巗ession.getAttribute("userName") <br /> application 鍖呭惈褰撳墠搴旂敤鐨凷ervletContext鐨勫睘鎬э紙attribute錛夌殑Map #application.userName鐩稿綋浜巃pplication.getAttribute("userName") <br /> attr 鐢ㄤ簬鎸塺equest > session > application欏哄簭璁塊棶鍏跺睘鎬э紙attribute錛?#attr.userName鐩稿綋浜庢寜欏哄簭鍦ㄤ互涓婁笁涓寖鍥達紙scope錛夊唴璇誨彇userName灞炴э紝鐩村埌鎵懼埌涓烘 <br /> <br /> 鐢ㄤ簬榪囨護鍜屾姇褰憋紙projecting)闆嗗悎錛屽books.{?#this.price<100}錛?<br /> 鏋勯燤ap錛屽#{'foo1':'bar1', 'foo2':'bar2'}銆?<br /> <br /> “%”絎﹀彿鐨勭敤閫旀槸鍦ㄦ爣蹇楃殑灞炴т負瀛楃涓茬被鍨嬫椂錛岃綆桹GNL琛ㄨ揪寮忕殑鍊箋?br /> “$”鏈変袱涓富瑕佺殑鐢ㄩ旓紝鐢ㄤ簬鍦ㄥ浗闄呭寲璧勬簮鏂囦歡涓紝寮曠敤OGNL琛ㄨ揪寮忋傚湪Struts 2閰嶇疆鏂囦歡涓紝寮曠敤OGNL琛ㄨ揪寮忋?br /> <br /> <br /> <br /> Struts2涓殑OGNL琛ㄨ揪寮忚璦鏄Xwork鐨凮GNL鐨勫皝瑁呫傛垜浠鐞嗚В涓涓嬪嚑鐐癸細 <br /> 1錛?Struts2涓皢ActionContext浣滀負OGNL鐨勪笂涓嬫枃鐜錛圓ctionContext鍐呴儴鍚湁涓涓狹ap瀵硅薄錛?<br /> 2錛?Struts2涓殑OGNL琛ㄨ揪寮忚璦鐨勬牴瀵硅薄鏄竴涓猇alueStack錛孷alueStack涓殑姣忎竴涓璞¢兘琚涓烘牴瀵硅薄銆?<br /> Struts2妗嗘灦灝嗗疄渚嬪寲鐨凙ction瀵硅薄鏀懼叆ValueStack涓紝濡傛灉鏄疉ction閾撅紝鍒欏涓狝ction閮藉瓨鍦ㄤ簬 ValueStack涓傝孷alueStack涓櫎浜咥ction澶栵紝Struts2妗嗘灦榪樺皢 parameters錛宺equest錛宺esponse錛宻ession錛宎pplication錛宎ttr絳夊璞℃斁鍒癡alueStack涓紝璁塊棶榪欎簺瀵硅薄闇瑕佸姞鍓嶇紑#銆?<br /> <br /> 鎬葷粨錛歋truts2涓殑鏁版嵁澶勭悊鍩轟簬Xwork鐨凮GNL錛屽畠鍦∣GNL鐨勫熀紜涓婅繘琛屼簡涓瀹氱殑灝佽銆侽GNL鐨勬牳蹇冩蹇墊槸鏍瑰璞?root)鍜屼笂涓嬫枃鐜(context)---浣犲彲浠ヤ紶鍏ヤ竴涓狹ap瀵硅薄浣滀負涓婁笅鏂囷紝鍚戝叾涓璸ut榪涗竴涓璞★紝閭d箞榪欎釜瀵硅薄鍙互浣滀負鏍瑰璞★紙ognl涓彲浠ュ悜鍑芥暟涓紶鍏ヤ笉鍚岀殑Map瀵硅薄浣滀負鏍瑰璞℃潵鎿嶄綔錛屼篃鍙互鎸囧畾涓嶅悓鐨勬牴瀵硅薄錛岃孲truts2涓紝瀹冨浐瀹氫簡鏍瑰璞alueStack錛夈傚湪Struts2 涓紝ActionContext浣滀負OGNL鐨勪笂涓嬫枃鐜錛屽畠鐨勬牴瀵硅薄鏄竴涓猇alueStack錛孷alueStack涓殑姣忎釜瀵硅薄閮借瑙嗕負鏍瑰璞°?Struts2涓殑Action浣滀負鏍瑰璞″瓨鍦?濡傛灉澶氫釜Action浠hain鐨勫艦寮忓瓨鍦紝鍒欏涓狝ction鍧囧瓨鍦ㄤ簬ValueStack涓紝鍧囦負鏍瑰璞?銆?<br /> <br /> <br /> <s:property value="user.name" /> <br /> <br /> <s:property value="%{#application.myApplicationAttribute}" /> <br /> <s:property value="%{#session.mySessionAttribute}" /> <br /> <s:property value="%{#request.myRequestAttribute}" /> <br /> <s:property value="%{#parameters.myParameter}" /> <br /> <br /> <br /> <br /> <img src ="http://www.tkk7.com/wansong/aggbug/326925.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/wansong/" target="_blank">w@ns0ng</a> 2010-07-23 12:32 <a href="http://www.tkk7.com/wansong/articles/326925.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Struts tipshttp://www.tkk7.com/wansong/articles/326906.htmlw@ns0ngw@ns0ngFri, 23 Jul 2010 02:26:00 GMThttp://www.tkk7.com/wansong/articles/326906.htmlhttp://www.tkk7.com/wansong/comments/326906.htmlhttp://www.tkk7.com/wansong/articles/326906.html#Feedback0http://www.tkk7.com/wansong/comments/commentRss/326906.htmlhttp://www.tkk7.com/wansong/services/trackbacks/326906.html http://book.csdn.net/bookfiles/479/10047916715.shtml   Struts 2鐨勫熀鏈厤緗?nbsp;

<
action name ="Login" class ="tutorial.Login" >
           
< result type ="chain" > AuthorizatedAccess </ result >
       
</ action >
       
< action name ="AuthorizatedAccess" class ="tutorial.AuthorizatedAccess" >
           
< interceptor-ref name ="auth" />
           
< result name ="login" > /Login.jsp </ result >
           
< result name ="success" > /ShowRole.jsp </ result >
       
</ action >


In struts2-showcase project:
<default-action-ref name="showcase" />
<action name="showcase">
            <result>showcase.jsp</result>
        </action>

In struts-default.xml of struts-core:
<default-interceptor-ref name="defaultStack"/>
<default-class-ref class="com.opensymphony.xwork2.ActionSupport" />


w@ns0ng 2010-07-23 10:26 鍙戣〃璇勮
]]>
Struts2 嫻佺▼ 鏋舵瀯鍥?/title><link>http://www.tkk7.com/wansong/articles/325953.html</link><dc:creator>w@ns0ng</dc:creator><author>w@ns0ng</author><pubDate>Tue, 13 Jul 2010 06:30:00 GMT</pubDate><guid>http://www.tkk7.com/wansong/articles/325953.html</guid><wfw:comment>http://www.tkk7.com/wansong/comments/325953.html</wfw:comment><comments>http://www.tkk7.com/wansong/articles/325953.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/wansong/comments/commentRss/325953.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/wansong/services/trackbacks/325953.html</trackback:ping><description><![CDATA[http://secyaher.blog.163.com/blog/static/38955772009610113458949/ <img src ="http://www.tkk7.com/wansong/aggbug/325953.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/wansong/" target="_blank">w@ns0ng</a> 2010-07-13 14:30 <a href="http://www.tkk7.com/wansong/articles/325953.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://vc77777.com" target="_blank">国产亚洲精品免费</a>| <a href="http://www2019rz.com" target="_blank">欧美好看的免费电影在线观看</a>| <a href="http://u6u6u6.com" target="_blank">免费人成视网站在线观看不卡</a>| <a href="http://yaojing123.com" target="_blank">亚洲一区二区三区久久</a>| <a href="http://btztjxc.com" target="_blank">国产精品久久永久免费</a>| <a href="http://1777000.com" target="_blank">亚洲AV无码国产精品色</a>| <a href="http://65123456.com" target="_blank">无人在线观看免费高清视频 </a>| <a href="http://my77789.com" target="_blank">亚洲视频在线一区</a>| <a href="http://fantoment.com" target="_blank">免费一级毛片无毒不卡</a>| <a href="http://cytanhuang.com" target="_blank">亚洲bt加勒比一区二区</a>| <a href="http://91xx8.com" target="_blank">1000部拍拍拍18免费网站</a>| <a href="http://zc-zk.com" target="_blank">亚洲制服丝袜一区二区三区</a>| <a href="http://cswangli.com" target="_blank">思思re热免费精品视频66</a>| <a href="http://www44wawa.com" target="_blank">国产成人精品亚洲2020</a>| <a href="http://fanqi5.com" target="_blank">日韩激情无码免费毛片</a>| <a href="http://wwwayx2026.com" target="_blank">美女隐私免费视频看</a>| <a href="http://fenxiangceo.com" target="_blank">亚洲区小说区图片区QVOD</a>| <a href="http://fenxiangceo.com" target="_blank">日韩精品人妻系列无码专区免费</a>| <a href="http://6006769.com" target="_blank">亚洲欧洲春色校园另类小说</a>| <a href="http://jastrelax.com" target="_blank">永久免费av无码不卡在线观看</a>| <a href="http://416164.com" target="_blank">亚洲愉拍一区二区三区</a>| <a href="http://513109.com" target="_blank">heyzo亚洲精品日韩</a>| <a href="http://6006769.com" target="_blank">99在线视频免费观看</a>| <a href="http://codecampo.com" target="_blank">亚洲精品mv在线观看</a>| <a href="http://dt677.com" target="_blank">爽爽日本在线视频免费</a>| <a href="http://53ggk.com" target="_blank">a毛片视频免费观看影院</a>| <a href="http://fdhkauto.com" target="_blank">亚洲人成亚洲精品</a>| <a href="http://chowngroup.com" target="_blank">成人免费无毒在线观看网站 </a>| <a href="http://k67m.com" target="_blank">99re6在线视频精品免费</a>| <a href="http://222xx8.com" target="_blank">亚洲视频一区在线</a>| <a href="http://yy6653.com" target="_blank">永久免费bbbbbb视频</a>| <a href="http://wwwav888.com" target="_blank">一级有奶水毛片免费看</a>| <a href="http://17soco.com" target="_blank">亚洲毛片免费观看</a>| <a href="http://fjwkjx.com" target="_blank">免费人成在线观看网站视频 </a>| <a href="http://jlzjjy.com" target="_blank">手机看黄av免费网址</a>| <a href="http://yy9977.com" target="_blank">一边摸一边桶一边脱免费视频</a>| <a href="http://600c63.com" target="_blank">亚洲成色在线综合网站</a>| <a href="http://directzx.com" target="_blank">成人免费视频小说</a>| <a href="http://lwjiheng.com" target="_blank">a级男女仿爱免费视频</a>| <a href="http://tskes.com" target="_blank">亚洲色偷偷综合亚洲AV伊人蜜桃 </a>| <a href="http://3789re.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>