我有一个FormBean要跨页验证,可以验证但不能显示错误信息
validator.xml
<formset>
<form name="userForm">
<field property="cpwd" depends="required" page="1">
<arg key="User Name" resource="false" position="0"/>
</field>
</form>
</formset>
//action中
ActionErrors errors = userForm.validate(mapping,request);
//判断是否有错误
if (errors == null || errors.isEmpty())
{
if (userForm.getPage() == 1)
{
return mapping.findForward("input2");
}
else if (userForm.getPage() == 2)
{
return mapping.findForward("success");
}
}
else
{
if (userForm.getPage() == 1)
{
return mapping.findForward("input1");
}
else
{
return mapping.findForward("input2");
}
}
return mapping.findForward("success");
}
jsp文件中
<html:errors/>可以验证,但不能显示出错信息.
那些错误信息已经加在ApplicationResources.文件中了
validator.xml
<formset>
<form name="userForm">
<field property="cpwd" depends="required" page="1">
<arg key="User Name" resource="false" position="0"/>
</field>
</form>
</formset>
//action中
ActionErrors errors = userForm.validate(mapping,request);
//判断是否有错误
if (errors == null || errors.isEmpty())
{
if (userForm.getPage() == 1)
{
return mapping.findForward("input2");
}
else if (userForm.getPage() == 2)
{
return mapping.findForward("success");
}
}
else
{
if (userForm.getPage() == 1)
{
return mapping.findForward("input1");
}
else
{
return mapping.findForward("input2");
}
}
return mapping.findForward("success");
}
jsp文件中
<html:errors/>可以验证,但不能显示出错信息.
那些错误信息已经加在ApplicationResources.文件中了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货