1. Modify in tags. jsp
<% @ Page iselignored = "false" %>
<% @ Taglib prefix = "html" uri = "http://struts.apache.org/tags-html" %>
<% @ Taglib prefix = "Bean" uri = "http://struts.apache.org/tags-bean" %>
<% @ Taglib prefix = "logic" uri = "http://struts.apache.org/tags-logic" %>
<% @ Taglib prefix = "C" uri = "http://java.sun.com/jsp/jstl/core" %>
<% @ Taglib prefix = "FMT" uri = "http://java.sun.com/jsp/jstl/fmt" %>
<% @ Taglib prefix = "FN" uri = "http://java.sun.com/jsp/jstl/functions" %>
<C: Set Var = "CTX" value = "$ {pagecontext. Request. contextpath}"/>
<LINK rel = "stylesheet" href = "$ {CTX}/CSS/common.css" type = "text/CSS"/>
<SCRIPT type = "text/JavaScript" src = "$ {CTX}/scripts/jquery. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "$ {CTX}/scripts/jquery. Validate. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "$ {CTX}/scripts/jquery. Metadata. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "$ {CTX}/scripts/localization/messages_cn.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "$ {CTX}/JS/common/my97datepicker/wdatepicker. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "$ {CTX}/JS/common/jqueryvalidate. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = '$ {CTX}/DWR/engine. js'> </SCRIPT>
<SCRIPT type = 'text/JavaScript 'src = '$ {CTX}/DWR/util. js'> </SCRIPT>
<SCRIPT type = "text/JavaScript">
<! --
VaR J = jquery. noconflict ();
// -->
</SCRIPT>
====================================
2. Modify the jqueryvalidate. js file.
VaR J = jquery. noconflict ();
// It can only contain Chinese characters, English letters, and numbers
J. validator. addmethod ("maxntext ",
Function (value, element, Param ){
VaR varreg =/^ [A-Z] | [A-Z] | [0-9] | [/u4e00-/u9fa5] $ /;
VaR varvalue = J. Trim (value );
For (VAR I = 0; I <varvalue. length; I ++ ){
VaR varchar = varvalue. charat (I );
If (! Varreg. Test (varchar ))
Return false;
}
VaR varlength = varvalue. Replace (/[^/x00-/xFF]/g, 'xx'). length;
Return this. Optional (element) | varlength> = Param [0] & varlength <= Param [1];
},
"Only Chinese characters, English letters, and numbers can be included, and the length must be between {0}-{1} bytes (one Chinese character is counted as 2 bytes )");
// Maxntext is in GBK encoding. Except for ASCII characters, all other characters occupy the width of two characters.
J. validator. addmethod ("getbyteslength ",
Function (value, element, Param ){
VaR varvalue = J. Trim (value );
VaR varlength = varvalue. Replace (/[^/x00-/xFF]/g, 'xx'). length;
Return this. Optional (element) | varlength> = Param [0] & varlength <= Param [1];
},
J. validator. Format ("ensure that the input value is between {0}-{1} bytes (two bytes for one text )"));
// Exactnnumerictext indicates a number with a fixed length of n characters.
J. validator. addmethod ("exactnnumerictext ",
Function (value, element ){
VaR varreg =/^ [0-9] + $ /;
VaR varvalue = J. Trim (value );
Return varreg. Test (varvalue );
},
J. validator. Format ("Make sure you enter a number "));
// Activecurrencyandamount indicates the currency symbol and amount. The integer part of the amount is a maximum of 16 digits, and the fractional part is fixed with two digits.
// For example, <amt ccy = "CNY"> 2784245.00 </AMT>
// For example, the value of one dollar can only be 1.00, and cannot be 1 or 1.0. The value of the first non-zero digit cannot be zero. (For example, the value of one dollar can only be 1.00, but cannot be 01.00 or add more 0 before ).
// Note: the currency symbol adopts the "ISO-4217: Codes for the Representation of Currencies and funds" standard, the currency symbol of the renminbi is "CNY ".
J. validator. addmethod ("activecurrencyandamount ",
Function (value, element ){
If (J. Trim (value) = ""){
Return false;
}
VaR Reg =/^ ([0] | ([1-9]/d {0, 15}) (./d {2}) {1} $ /;
Return Reg. Test (value );
},
"Currency symbols and amounts, where the integer part of the amount can be up to 16 digits, and the fractional part is fixed with 2 digits ");
// Summaryamounttext indicates the sum. The currency symbol (3 digits) and the positive and negative amount identifier (1 digit) indicate the sum. The decimal part 2 is a number, and the integer part has a maximum of 20 digits, decimal point (1 digit)
J. validator. addmethod ("summaryamounttext ",
Function (value, element ){
If (J. Trim (value) = ""){
Return false;
}
VaR Reg =/^ [A-z | A-Z] {3} ([0] | (/-{} [1-9]/d }))(. /d {2}) {1} $ /;
Return Reg. Test (value );
},
"Currency symbol (3 digits), positive and negative amount identifier (1 digit), decimal part 2 is a number, integer part a maximum of 20 digits ");
// Amounttext indicates the amount, where the currency symbol (3 digits), the decimal part 2 is a number, the integer part is a maximum of 16 digits, and the decimal point (1 digit ).
J. validator. addmethod ("amounttext ",
Function (value, element ){
If (J. Trim (value) = ""){
Return false;
}
VaR Reg =/^ [A-z | A-Z] {3} ([0] | ([1-9]/d }))(. /d {2}) {1} $ /;
Return Reg. Test (value );
},
"Currency symbol (3 digits), decimal part 2 is a number, integer part is up to 16 digits ");
// Decimalnumber indicates the number. The integer part can contain up to 16 digits, and the decimal part is fixed with two digits.
J. validator. addmethod ("decimalnumber ",
Function (value, element ){
If (J. Trim (value) = ""){
Return false;
}
VaR Reg =/^ ([0] | ([1-9]/d {0, 15}) (./d {2}) {1} $ /;
Return Reg. Test (value );
},
"The integer part can contain up to 16 digits, and the fractional part is fixed with 2 digits ");
// Percentagerate indicates the interest rate. A maximum of 11 digits are allowed, and a maximum of 10 digits are allowed in the fractional part.
J. validator. addmethod ("percentagerate ",
Function (value, element ){
If (J. Trim (value) = ""){
Return false;
}
VaR Reg =/^ ([0] | ([1-9]/d {}) (./d {}) {1} $ /;
If (Reg. Test (J. Trim (value ))){
If (J. Trim (value). length> 12 ){
Return false;
}
}
Return Reg. Test (value );
},
"A maximum of 11 digits, of which the decimal part can contain up to 10 digits ");
// The value of the first-generation message is 15 bits, with a 13-digit integer + 2 decimal places, amount_1 and an amount
J. validator. addmethod ("amount_1", function (value, element ){
If (J. Trim (value) = ""){
Return false;
}
Return/^/d {} (/./d {}) {} $/. Test (value );
},
"The integer cannot exceed 13 digits, and the decimal number cannot exceed 2 digits ");
// Row number, 12 or 14 digits
J. validator. addmethod ("bankcode", function (value, element ){
If (J. Trim (value) = ""){
Return false;
}
Return/^ (/d {12} |/d {14}) $/. Test (value );
},
"The row number must be 12 or 14 digits ");
================================
3. Replace $ in each JSP file with J.