不知为什么贴不上来

03-06-13 tony_2008

“我的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代码如下:

但是此脚本却不执行!请问高手这是怎么回事?”

tony_2008
2003-06-13 17:50

“我的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>

但是此脚本却不执行!请问高手这是怎么回事?”

banq
2003-06-13 18:48

使用按钮Code