Struts之自定义Validator

在使用Struts的时候,验证是使用Validator来做,但是有时候需要有自己的验证规则,幸运的是我们可以方便地进行扩展。
比如我们想定义一个规则来判定两次输入的密码是相等的。我们需要这样做,首先我们需要一个类,象这样子 :

package com.motel168.util;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.validator.Field;
import org.apache.commons.validator.GenericValidator;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.ValidatorUtil;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.validator.Resources;

public class MyValidator {
    public static boolean validateTwoFields(Object bean,ValidatorAction va,Field field,ActionErrors errors,HttpServletRequest request){
       
        String value = ValidatorUtil.getValueAsString(bean,field.getProperty());
        String sProperty2 = field.getVarValue("secondProperty");
        String value2 = ValidatorUtil.getValueAsString(bean,sProperty2);
        if(!GenericValidator.isBlankOrNull(value)){
            try{
                if(!value.equals(value2)){
                    errors.add(field.getKey(),Resources.getActionError(request,va,field));
                    return false;
                }
            }catch(Exception e){
                errors.add(field.getKey(),Resources.getActionError(request,va,field));
                return false;
            }
        }
        return true;
    }
   
}

上面这个类就是用来判断两个域是否相等,很简单,但是注意方法名一定要是validateXXX。

接下来需要扩展validator-rules.xml,在之前加入这么一段:
      
  
             
   
 methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,org.apache.struts.action.ActionErrors,javax.servlet.http.HttpServletRequest"
                   depends="required" msg="errors.twofield">
     
      <br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; function validateTwoFields(form){<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var bValid = true;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var focusField = null;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var i = 0;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var fields = new Array();<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; oTwoFields = new twofields();<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for(x in oTwoFields){<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var field = form[oTwoFields[x][0]];<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var secondField = form[oTwoFields[x][2]("secondProperty")];<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(field.type=="text"||field.type=="textarea"||field.type=="select-one"||field.type=="radio"||field.type=="password"){<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var value;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var secondValue;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(field.type=="select-one"){<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var si = field.selectedIndex;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; value = field.options[si].value;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; secondValue = secondField.options[si].value;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }else{<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; value=field.value;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; secondValue = secondField.value;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(value!=secondValue){<br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(i==0){<br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; focusField = field;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; fields[i++]=oTwoFields[x][1];<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; bValid = flase;<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; }<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; if(fiels.length &gt; 0){<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; focusFiled.focus();<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; alert(fields.join('\n'));<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br /> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; return bValid;<br /> &nbsp;&nbsp;&nbsp; &nbsp; <br /> &nbsp;&nbsp;&nbsp; &nbsp; ]]&gt;<br /> &nbsp;&nbsp;&nbsp; &nbsp; </javascript><br /> &nbsp;&nbsp;&nbsp; &nbsp; </validator>&nbsp;&nbsp;&nbsp; <br /> </pre>然后使用的时候就和其他没什么两样的了:<br /><pre class=code>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <field property="newPassword1" depends="required,twofields"><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <msg name="required" key="errors.required" /><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <msg name="tworfields" key="errors.twofields" /><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <arg0 key="errors.newpassword1" /><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <arg1 key="errors.newpassword2" /><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <var><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <var-NAME>secondProperty</VAR-NAME><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <var-VALUE>newPassword2</VAR-VALUE><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </var><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </field><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <field property="newPassword2" depends="required"><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <msg name="required" key="errors.required" /><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <arg0 key="errors.newpassword2" /><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </field><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br /> <br /> </pre><br />注意这个地方<br /><pre class=code>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <var><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <var-NAME>secondProperty</VAR-NAME><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <var-VALUE>newPassword2</VAR-VALUE><br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </var><br /> </pre>就是我们在java类中读取的变量,它代表的是另外的一个域。<br />在JSP中的使用就不再说明了,大功告成:)。<br /><br /><p>本文出自 “<a href='http://442277.blog.51cto.com'>log4deng</a>” 博客,转载请与作者联系!</p> </div><!--正文 end--> <script type="text/javascript"> var kevent = 'onabort|onblur|onchange|onclick|ondblclick|onerror|onfocus|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onresize|onselect|onsubmit|onunload'; var aevent = kevent.split('|'); jQuery('.showContent img').each(function(){ var nimg = this; jQuery.each(aevent, function(i, n){ if (n!='onload') { jQuery(nimg).attr(n, ''); } else { if (jQuery(nimg).attr(n) != 'if(this.width>650) this.width=650;') { jQuery(nimg).attr(n, ''); } } }); }); </script> <script type="text/javascript" charset="utf-8"> var encodetitle = encodeURI('一篇很棒的博文分享给大家:《Struts之自定义Validator 》'); function show51share(){ window.open('http://t.51cto.com/index.php?m=share&url=http://442277.blog.51cto.com/432277/89412&type=l&count=&relateUid=&appkey=3843950324&title=' + encodetitle); } </script> <div class="m_sharebtn clear"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="11%" height="43" align="center" valign="middle"><img src="http://img1.51cto.com/images/share/ssk.png" alt="分享至"/></td> <td width="77%" align="left" valign="top"> <!-- <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_mshare" data-cmd="mshare" title="分享到一键分享"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_bdhome" data-cmd="bdhome" title="分享到百度新首页"></a><a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a><a href="#" class="bds_youdao" data-cmd="youdao" title="分享到有道云笔记"></a><a href="#" class="bds_bdysc" data-cmd="bdysc" title="分享到百度云收藏"></a><a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a></div> <script> var bds_config = {'wbUid':1706976420}; window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"1","bdMiniList":false, 'bdPic':'http://blog.51cto.com/attachment/201305/173413310.jpg',"bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)]; </script> --> <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_mshare" data-cmd="mshare" title="分享到一键分享"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_bdhome" data-cmd="bdhome" title="分享到百度新首页"></a><a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a><a href="#" class="bds_youdao" data-cmd="youdao" title="分享到有道云笔记"></a><a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a><a href="#" class="bds_bdysc" data-cmd="bdysc" title="分享到百度云收藏"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a></div> <script>window._bd_share_config={"common":{"bdSnsKey":{"tsina":"2065779340"},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"http://blog.51cto.com/img/blog_down0731.jpg","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> <!-- Baidu Button END --></td> <td width="12%" align="right" valign="middle"><a href="javascript:favorBox('open');" title="一键收藏,随时查看,分享好友!"><img src="http://home.51cto.com/public/themes/blue/images/favorite_add_small.gif" border="0" alt="一键收藏,随时查看,分享好友!" /></a></td> </tr> </table> </div> <div class="showBottom"> <!--<div class="reviews"><span class="fl" style="cursor:pointer;"><a onclick="openFavoulist();" id="favourer"></a> </span><div id="favourdiv" class="support01">0人</div> <span class="fl">了这篇文章</span></div>--> <table width="720" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="right"><img src="http://phpanddb.blog.51cto.com/image/skin/25/icon01.png" width="15" height="16" /> <span style="cursor:pointer;"><a onclick="openFavoulist();" id="favourer"></a></span></td> <td width="70" align="left"><div style="line-height:28px;" id="favourdiv" class="support01">0人</div></td> <td width="60" align="left">了这篇文章</td> </tr> </table> <div class="showType">类别:<a href="/432277/d-3" class="operlink">J2EE</a>┆阅读(<span id="readNum">0</span>)┆评论(<span id='cmtNum' >0</span>) ┆ <a href="/">返回博主首页</a>┆<a href="http://blog.51cto.com">返回博客首页</a></div> <div class="prevNext"> 上一篇 <a href="/432277/89411" class="operlink" title="SCWCD笔记转载 ">SCWCD笔记转载 </a> 下一篇 <a href="/432277/89413" class="operlink" title="用AXIS开始WebService之设置 ">用AXIS开始WebService之设置 </a> </div> </div> </div><!--showBottom end--> </div><!--modCon--> <span class="modBot"></span> </div><!--artShow end--> <span class="blank"></span> <div class="relatedArt box"> <a href="http://gaozhao.51cto.com/resume/add?blog" target="_blank"><img src="http://s3.51cto.com/wyfs02/M01/78/B9/wKiom1aCJOSC9pY9AAECVetlVKk211.jpg" /></a> </div> <div class="artComm " style="height:170px;"> <div class="relatedArt box1 mr10"> <div class="title" name="zhuanti" id="zhuanti"><h2>相关文章</h2></div> <div class="modCon"> <ul> <li><a href="http://edgenhuang.blog.51cto.com/47333/23718" title="Struts Validator 之 javascript 分析" target="_blank">Struts Validator 之 javascript 分析</a></li> <li><a href="http://edgenhuang.blog.51cto.com/47333/23719" title="Struts Validator 与 prototype 冲突 问题 解决" target="_blank">Struts Validator 与 prototype 冲突 问题 解决</a></li> <li><a href="http://fluagen.blog.51cto.com/146595/36471" title="struts 学习笔记之MVC模式(附 :PO/POJO/BO/DTO/VO的区别 )" target="_blank">struts 学习笔记之MVC模式(附 :PO/POJO/BO/..</a></li> <li><a href="http://tscjsj.blog.51cto.com/412451/84819" title="Struts工作原理" target="_blank">Struts工作原理</a></li> </ul> <span class="blank6"></span> </div><!--modCon end--> <span class="modBot"></span> </div> <!--相关文章 end--> <div class="relatedArt box1"> <div class="title" name="zhuanti" id="zhuanti"><h2>职位推荐</h2></div> <div class="modCon"> <ul> <li><a href="http://gaozhao.51cto.com/job/view/id-1170.html" target="_blank">Java开发工程师</a></li> <li><a href="http://gaozhao.51cto.com/job/view/id-1168.html" target="_blank">Java Engineer</a></li> <li><a href="http://gaozhao.51cto.com/job/view/id-1106.html" target="_blank">高级Java想挣钱的看看</a></li> <li><a href="http://gaozhao.51cto.com/job/view/id-1164.html" target="_blank">高级Java开发工程师</a></li> <li><a href="http://gaozhao.51cto.com/job/view/id-1149.html" target="_blank">JAVA工程师</a></li> </ul> <span class="blank6"></span> </div><!--modCon end--> <span class="modBot"></span> </div><!--职位推荐 end--> </div> <div class="artComm box"> <div class="title"><a name="replay"></a><h2>文章评论</h2></div> <div class="modCon" id="artcomment"> <div> &nbsp;</div><div> &nbsp;</div> </div><!--modCon--> <span class="modBot"></span> </div><!--commBox end--> <a href="" id="com_top_top"></a> <div class="artComm box" style="750px;height:90px"> <script type="text/javascript"> var cpro_id = "u2386995"; </script> <script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script> </div><form action='/comment.php?' method='post' name='form1' id='form1' onSubmit='return commentSubmit(this,"");'> <span class="blank1"></span> <div class="box writeComm" style="min-height:30px;"> <a name='comment'></a> <input type='hidden' name='action' value='comment'> <input id='commenttid' type='hidden' name='tid' value='89412'> <input type="hidden" name="com_count_ajax" id="com_count_ajax" value="1" /> <div class="title"> <h2 class="fl">发表评论&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h2> <span class="fl" id="messageTj"></span> <style type="text/css"> a.mred:link{ color:#ff0000; text-decoration:underline;} a.mred:visited{color:#ff0000;} a.mred:hover{color:#ff0000;} a.mred:active{color:#ff0000;} </style> </div> <div style="display:none" rel='51CTO电子期刊改版意见大征集,提你所需,建你所想!' id="ggBox"> <script type='text/javascript'><!--//<![CDATA[ var m3_u = (location.protocol=='https:'?'https://gg.51cto.com/www/delivery/ajs.php':'http://gg2.51cto.com/www/delivery/ajs.php'); var m3_r = Math.floor(Math.random()*99999999999); if (!document.MAX_used) document.MAX_used = ','; document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u); document.write ("?zoneid=460"); document.write ('&amp;cb=' + m3_r); if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used); document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : '')); document.write ("&amp;loc=" + escape(window.location)); if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer)); if (document.context) document.write ("&context=" + escape(document.context)); if (document.mmm_fo) document.write ("&amp;mmm_fo=1"); document.write ("'><\/scr"+"ipt>"); //-->

你可能感兴趣的:(struts,职场,自定义,Validator,休闲)