锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产69精品久久久久99,久久婷婷蜜乳一本欲蜜臀,久久久水蜜桃http://www.aygfsteel.com/zhengzhili/category/46735.html涔﹀北鏈夎礬鍕や負寰勶紝瀛︽搗鏃犳動鑻︿綔鑸?/description>zh-cnMon, 08 Nov 2010 14:25:02 GMTMon, 08 Nov 2010 14:25:02 GMT60Struts2瀛︿範絎旇 鈥斺?涓婁紶鍜屼笅杞?/title><link>http://www.aygfsteel.com/zhengzhili/archive/2010/11/07/337455.html</link><dc:creator>Brian</dc:creator><author>Brian</author><pubDate>Sun, 07 Nov 2010 06:19:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhengzhili/archive/2010/11/07/337455.html</guid><wfw:comment>http://www.aygfsteel.com/zhengzhili/comments/337455.html</wfw:comment><comments>http://www.aygfsteel.com/zhengzhili/archive/2010/11/07/337455.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhengzhili/comments/commentRss/337455.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhengzhili/services/trackbacks/337455.html</trackback:ping><description><![CDATA[     鎽樿:     Struts2榛樿浣跨敤Jakarta鐨凜ommon-FileUpload鐨勬枃浠朵笂浼犺В鏋愬櫒銆傝struts.properties閰嶇疆鏂囦歡涓細 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#鎸囧畾浣跨敤COS鐨勬枃浠朵笂...  <a href='http://www.aygfsteel.com/zhengzhili/archive/2010/11/07/337455.html'>闃呰鍏ㄦ枃</a><img src ="http://www.aygfsteel.com/zhengzhili/aggbug/337455.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhengzhili/" target="_blank">Brian</a> 2010-11-07 14:19 <a href="http://www.aygfsteel.com/zhengzhili/archive/2010/11/07/337455.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Struts2瀛︿範絎旇鈥斺旇緭鍏ユ牎楠岋紙浜岋級http://www.aygfsteel.com/zhengzhili/archive/2010/10/24/336024.htmlBrianBrianSun, 24 Oct 2010 07:35:00 GMThttp://www.aygfsteel.com/zhengzhili/archive/2010/10/24/336024.htmlhttp://www.aygfsteel.com/zhengzhili/comments/336024.htmlhttp://www.aygfsteel.com/zhengzhili/archive/2010/10/24/336024.html#Feedback0http://www.aygfsteel.com/zhengzhili/comments/commentRss/336024.htmlhttp://www.aygfsteel.com/zhengzhili/services/trackbacks/336024.html     瀵逛簬login鏂規硶鐨勬牎楠岋紝鍙互閫氳繃<ActionClassName>-<ActionAliasName>-validation.xml鏂囦歡鏉ユ牎楠岋紝鍗砇egistAction-login-validation.xml鏂囦歡榪涜鏍¢獙銆傚悓鏃訛紝RegistAction-validation.xml鐨勬牎楠岃鍒欎粛鏃уlogin鏂規硶鏈夋晥銆傚嵆login鏂規硶鐨勬牎楠岃鍒欐槸Region-validation.xml鍜孯egistAction-login-validation.xml鐨勬誨拰銆?br />     濡傛灉RegistAction緇ф壙浜咮aseAction錛岄偅涔堝浜嶣aseAction綾葷殑鏍¢獙瑙勫垯涔熶細琚玆egistAction綾繪墍緇ф壙鏍¢獙銆傚叿浣撴潵璇達紝鍏舵牎楠岃鍒欑殑鎼滅儲鏂囦歡瑙勫垯濡備笅錛?br />         BaseAction-validation.xml
        BaseAction-鍒悕-validation.xml
        RegistAction-validation.xml
        RegistAction-鍒悕-validation.xml

    瀵逛簬Struts2鎵鏀寔鐨勫唴寤烘牎楠屽櫒錛屾垜浠彲浠ラ氳繃xwork.2.1.2.jar涓殑com/opensymphony/xwork2/validator/validators/default.xml鏂囦歡鏌ョ湅銆?/p>

    闄や簡閰嶇疆鏂囦歡錛孲truts2涔熸敮鎸丄nnotation銆備笅闈㈠氨鏄嬌鐢ˋnnotation閰嶇疆鐨凴egistAction:

@Validation()
public class RegistAction extends ActionSupport {
    private static final long serialVersionUID = -2113900523366315993L;
    
    //璇ヨ姹傚寘鍚殑4涓姹傚弬鏁?br />     private String name;
    private String pass;
    private int age;
    private Date birth;
    
    
    public String getName() {
        return name;
    }
        @RequiredStringValidator(type=ValidatorType.FIELD,key="name.required",message="")
        @RegexFieldValidator(type=ValidatorType.FIELD,expression="\\w{4,25}",key="name.regex",message="")
    public void setName(String name) {
        this.name = name;
    }
    public String getPass() {
        return pass;
    }
        @RequiredStringValidator(type=ValidatorType.FIELD,key="pass.required",message="")
        @RegexFieldValidator(type=ValidatorType.FIELD,expression="\\w{4,25}",key="pass.regex",message="")
    public void setPass(String pass) {
        this.pass = pass;
    }
    public int getAge() {
        return age;
    }
        @IntRangeFieldValidator(message="",key="age.range",min="1",max="150")
    public void setAge(int age) {
        this.age = age;
    }
    public Date getBirth() {
        return birth;
    }
        @DateRangeFieldValidator(message="",key="birth.range",min="1900/01/01",max="2050/01/21")
    public void setBirth(Date birth) {
        this.birth = birth;
    }
}

     

    瀵逛簬涓嶈兘閫氳繃鍐呯疆鏍¢獙鍣ㄨ繘琛屾牎楠岀殑閫昏緫錛屽垯鍙氳繃閲嶅啓validate()鏂規硶鏉ュ疄鐜般傚鏋滀竴涓狝ction涓瓨鍦ㄥ涓昏緫澶勭悊錛屽垯闇瑕侀氳繃validateXxx()鏂規硶鏉ュ垎鍒繘琛屾牎楠岋紝鍏朵腑Xxx浠h〃鏂規硶鍚嶃傚login()鏂規硶瀵瑰簲鐨勬牎楠屾柟娉曚負validateLogin()銆?/p>

    Struts2鐨勮緭鍏ユ牎楠屾祦紼嬶細

    1銆傜被鍨嬭漿鎹㈠櫒璐熻矗瀵瑰瓧絎︿覆鐨勮姹傚弬鏁版墽琛岀被鍨嬭漿鎹紝騫跺皢榪欎簺鍊艱緗垚Action鐨勫睘鎬у箋?/p>

    2銆傚湪鎵ц綾誨瀷杞崲榪囩▼涓紝濡傛灉鍙戠敓寮傚父錛屽垯灝嗗紓甯鎬繚瀛樺埌ActionContext涓紝騫剁敱conversionError鎷︽埅鍣ㄨ礋璐e皢鍏跺皝瑁呭埌fieldError閲屻傜劧鍚庢墽琛岀3姝ワ紱濡傛棤寮傚父錛岀洿鎺ユ墽琛岀3姝ャ?/p>

    3銆傝皟鐢⊿truts2鍐呯疆鐨勮緭鍏ユ牎楠岃鍒欒繘琛岃緭鍏ユ牎楠?/p>

    4銆傞氳繃鏀懼皠璋冪敤validateXxx()鏂規硶銆?/p>

    5銆傝皟鐢╲alidate()鏂規硶銆?/p>

    6銆傚鏋滀笂榪伴兘鏈彂鐢焒ieldError錛屽皢璋冪敤Action閲屽鐞嗙敤鎴瘋姹傜殑澶勭悊鏂規硶錛涘鏋滃嚭鐜頒簡fieldError錛屽垯杞叆input閫昏緫瑙嗗浘鎵鎸囧畾鐨勮鍥捐祫婧愩?



Brian 2010-10-24 15:35 鍙戣〃璇勮
]]>
Struts2瀛︿範絎旇鈥斺旇緭鍏ユ牎楠岋紙涓錛?/title><link>http://www.aygfsteel.com/zhengzhili/archive/2010/10/24/336019.html</link><dc:creator>Brian</dc:creator><author>Brian</author><pubDate>Sun, 24 Oct 2010 07:01:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhengzhili/archive/2010/10/24/336019.html</guid><wfw:comment>http://www.aygfsteel.com/zhengzhili/comments/336019.html</wfw:comment><comments>http://www.aygfsteel.com/zhengzhili/archive/2010/10/24/336019.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhengzhili/comments/commentRss/336019.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhengzhili/services/trackbacks/336019.html</trackback:ping><description><![CDATA[     鎽樿:     Struts2鎻愪緵浜嗗熀浜庨獙璇佹鏋剁殑杈撳叆鏍¢獙錛屽湪榪欑鏍¢獙鏂瑰紡涓嬶紝鎵鏈夌殑杈撳叆鏍¢獙鍙渶瑕侀氳繃鎸囧畾鐨勯厤緗枃浠跺嵆鍙係truts2涓瘡涓狝ction閮芥湁涓涓牎楠屾枃浠訛紝鍏惰鍒欎負錛?lt;Action鍚嶅瓧>-validation.xml銆傚錛?Code highlighting produced by Actipro CodeHighlighter (freewar...  <a href='http://www.aygfsteel.com/zhengzhili/archive/2010/10/24/336019.html'>闃呰鍏ㄦ枃</a><img src ="http://www.aygfsteel.com/zhengzhili/aggbug/336019.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhengzhili/" target="_blank">Brian</a> 2010-10-24 15:01 <a href="http://www.aygfsteel.com/zhengzhili/archive/2010/10/24/336019.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> 主站蜘蛛池模板: <a href="http://" target="_blank">泰安市</a>| <a href="http://" target="_blank">抚远县</a>| <a href="http://" target="_blank">博爱县</a>| <a href="http://" target="_blank">大安市</a>| <a href="http://" target="_blank">丹巴县</a>| <a href="http://" target="_blank">藁城市</a>| <a href="http://" target="_blank">新平</a>| <a href="http://" target="_blank">精河县</a>| <a href="http://" target="_blank">格尔木市</a>| <a href="http://" target="_blank">潮州市</a>| <a href="http://" target="_blank">临朐县</a>| <a href="http://" target="_blank">依安县</a>| <a href="http://" target="_blank">清河县</a>| <a href="http://" target="_blank">南开区</a>| <a href="http://" target="_blank">泽库县</a>| <a href="http://" target="_blank">齐河县</a>| <a href="http://" target="_blank">霍州市</a>| <a href="http://" target="_blank">汉阴县</a>| <a href="http://" target="_blank">南川市</a>| <a href="http://" target="_blank">北京市</a>| <a href="http://" target="_blank">田东县</a>| <a href="http://" target="_blank">盱眙县</a>| <a href="http://" target="_blank">龙里县</a>| <a href="http://" target="_blank">曲沃县</a>| <a href="http://" target="_blank">昆山市</a>| <a href="http://" target="_blank">博罗县</a>| <a href="http://" target="_blank">拜城县</a>| <a href="http://" target="_blank">中西区</a>| <a href="http://" target="_blank">安平县</a>| <a href="http://" target="_blank">古交市</a>| <a href="http://" target="_blank">南汇区</a>| <a href="http://" target="_blank">德兴市</a>| <a href="http://" target="_blank">思茅市</a>| <a href="http://" target="_blank">遵义市</a>| <a href="http://" target="_blank">昭苏县</a>| <a href="http://" target="_blank">大竹县</a>| <a href="http://" target="_blank">乐昌市</a>| <a href="http://" target="_blank">南澳县</a>| <a href="http://" target="_blank">邹平县</a>| <a href="http://" target="_blank">永春县</a>| <a href="http://" 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>