Create Valiation method in the form class and access it from action class.
Plz refer following sample code and u dont need to use sttuts validation.
private ActionErrors BusinessValidation(ActionMapping mapping, HttpServletRequest req) {
ActionErrors errors = new ActionErrors();
String method = req.getParameter("method");
if(!"submit".equals(method))
return errors;
errors = super.validate(mapping,req);
if(errors.size() > 0)
return errors;
String name = groupTypeVOType.getName().trim();
int nameLength = name.length();
if (PasskeyUtils.replaceAllSpecialChars(name).length( ) <nameLength) {
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("PPlDC_ValErrMsg_16"));
}
if(groupTypeVOType.getCode().size() != 0) {
CodeVOType TypeCodeVO = (CodeVOType)groupTypeVOType.getCode().get(0);
if(TypeVOType.getTypeID()!=0){
if(TypeCodeVO.getCode().equalsIgnoreCase("")){
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("PPlDC_ValErrMsg_25"));
}
}
if (eCodeVO.getCode().length() > (Utils.replaceAllSpecialChars(
groupTypeCodeVO.getCode())).length()) {
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("PPlDC_ValErrMsg_17"));
}
}
return errors;
}
Thanks and Regards,
SACHIN S.TATHOD
Patni Computer System Ltd.
Magarpatta City, Cyber City,
Tower 3,Level I & II,
Hadapsar,Pune - 411028
Mobile No:- +91-9881239401
Email ID:-
[email protected]