急,急,急,請教高手struts驗證的問題!
我的jsp檔案如下:
<html:form action="/oa/fawen" focus="wenjianbiaoti" onsubmit="return validateFawenForm(this);">
</html:form>
<html:javascript formName="fawenForm"
dynamicJavascript="true"
staticJavascript="false"/>
<script language="Javascript1.1" src="staticJavascript.jsp"></script>
validator.xml檔案中的片斷如下:
<form name="fawenForm">
<field property="wenjianbiaoti" depends="required,minlength,maxlength">
<arg0 key="fawenForm.wenjianbiaoti"/>
<arg1 key="${var:minlength}" name="minlength" resource="false"/>
<arg2 key="${var:maxlength}" name="maxlength" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>20</var-value>
</var>
<var>
<var-name>minlength</var-name>
<var-value>6</var-value>
</var>
</field>
</form>
struts-config.xml檔案中的片斷如下:
<form-bean name="fawenForm" type="com.eway.oa.fawen.FawenForm"/>
<action-mappings>
<action input="fawen" name="fawenForm" path="/oa/fawen" scope="request"
type="com.eway.oa.fawen.FawenAction" validate="true">
<forward name="success" path="/oa/fawen/fawen.jsp" redirect="false"/>
</action>
</action-mappings>
jsp檔案執行後已經生成了驗證的指令碼,生成的HTML程式碼如下:
<form name="fawenForm" method="post" action="/oa/fawen.do" onsubmit="return validateFawenForm(this);">
</form>
<script type="text/javascript" language="JavaScript">
<!--
var focusControl = document.forms["fawenForm"].elements["wenjianbiaoti"];
if (focusControl.type != "hidden") {
focusControl.focus();
}
// -->
</script>
<script type="text/javascript" language="Javascript1.1">
<!-- Begin
var bCancel = false;
function validateFawenForm(form) {
if (bCancel)
return true;
else
return validateMaxLength(form) && validateMinLength(form) && validateRequired(form);
}
function maxlength () {
this.aa = new Array("wenjianbiaoti", " cannot be greater than 20 characters.", new Function ("varName", "this.maxlength='20'; this.minlength='6'; return this[varName];"));
}
function minlength () {
this.aa = new Array("wenjianbiaoti", " cannot be less than 6 characters.", new Function ("varName", "this.maxlength='20'; this.minlength='6'; return this[varName];"));
}
function required () {
this.aa = new Array("wenjianbiaoti", " is required.", new Function ("varName", "this.maxlength='20'; this.minlength='6'; return this[varName];"));
}
//End -->
</script>
但是此指令碼卻不執行!請問高手這是怎麼回事?
<html:form action="/oa/fawen" focus="wenjianbiaoti" onsubmit="return validateFawenForm(this);">
</html:form>
<html:javascript formName="fawenForm"
dynamicJavascript="true"
staticJavascript="false"/>
<script language="Javascript1.1" src="staticJavascript.jsp"></script>
validator.xml檔案中的片斷如下:
<form name="fawenForm">
<field property="wenjianbiaoti" depends="required,minlength,maxlength">
<arg0 key="fawenForm.wenjianbiaoti"/>
<arg1 key="${var:minlength}" name="minlength" resource="false"/>
<arg2 key="${var:maxlength}" name="maxlength" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>20</var-value>
</var>
<var>
<var-name>minlength</var-name>
<var-value>6</var-value>
</var>
</field>
</form>
struts-config.xml檔案中的片斷如下:
<form-bean name="fawenForm" type="com.eway.oa.fawen.FawenForm"/>
<action-mappings>
<action input="fawen" name="fawenForm" path="/oa/fawen" scope="request"
type="com.eway.oa.fawen.FawenAction" validate="true">
<forward name="success" path="/oa/fawen/fawen.jsp" redirect="false"/>
</action>
</action-mappings>
jsp檔案執行後已經生成了驗證的指令碼,生成的HTML程式碼如下:
<form name="fawenForm" method="post" action="/oa/fawen.do" onsubmit="return validateFawenForm(this);">
</form>
<script type="text/javascript" language="JavaScript">
<!--
var focusControl = document.forms["fawenForm"].elements["wenjianbiaoti"];
if (focusControl.type != "hidden") {
focusControl.focus();
}
// -->
</script>
<script type="text/javascript" language="Javascript1.1">
<!-- Begin
var bCancel = false;
function validateFawenForm(form) {
if (bCancel)
return true;
else
return validateMaxLength(form) && validateMinLength(form) && validateRequired(form);
}
function maxlength () {
this.aa = new Array("wenjianbiaoti", " cannot be greater than 20 characters.", new Function ("varName", "this.maxlength='20'; this.minlength='6'; return this[varName];"));
}
function minlength () {
this.aa = new Array("wenjianbiaoti", " cannot be less than 6 characters.", new Function ("varName", "this.maxlength='20'; this.minlength='6'; return this[varName];"));
}
function required () {
this.aa = new Array("wenjianbiaoti", " is required.", new Function ("varName", "this.maxlength='20'; this.minlength='6'; return this[varName];"));
}
//End -->
</script>
但是此指令碼卻不執行!請問高手這是怎麼回事?
相關文章
- 請教高手關於解析xml檔案的問題 急~~XML
- 急!!請高手幫忙
- 彭老師:關於SimpleJdonFrameworkTest的執行問題,急!急!急!急!急!急!Framework
- 請教資料庫連線問題??急!資料庫
- struts的validator框架問題?急框架
- Spring+struts 的問題 急!~~Spring
- 求教併發問題(非常急,線上等,高手賜教)
- [求助]struts的bean:write的問題,急!Bean
- jive2.1.2快取問題?各位高手,請指教!!急快取
- 關於反射的問題,請高手幫忙!線上急等!反射
- 請教關於執行緒的結束問題,急!!!執行緒
- fastreport3分組指令碼問題,急,急,急AST指令碼
- 急,高手幫忙!
- 急!急!急!急招軟體工程師軟體工程工程師
- 請教!急!急!修改文字檔案一行的內容 根據“=”分割。
- 急!請教用optimizeit檢測記憶體洩漏的問題?記憶體
- 各位高手們,我急~~~~
- 急!!!高手來幫忙呀!!
- 急!!!高手快來幫忙!!!
- 請教高手 關於STRUTS DATASOURCE的問題
- 急問:mysql出現的問題MySql
- jive安裝問題 急!~~~~~~~
- 我的JVM為什麼會報如下錯誤呢?急!急!急!急!十萬火急!JVM
- 請教分散式事務的具體處理:急!!!!分散式
- IM伺服器的問題,急!!!伺服器
- oracle 8080埠的問題,急!!!Oracle
- JSP中文問題,急助!!!JS
- 資料庫中文問題,急資料庫
- 急 mysql安裝問題(轉)MySql
- .net平臺與axis之間的互操作問題,急等高手
- 求助websphere下的叢集問題?急!!Web
- hibernate中oracle的問題,,急啊?Oracle
- html:text初始值問題.急!!HTML
- 急:linux下轉碼問題Linux
- 緊急求助!jive安裝問題。
- javascript呼叫applet問題?急JavaScriptAPP
- 高薪誠聘JAVA高手.(急!)(年薪十萬元)高薪Java
- 關於sequence問題的緊急處理