问题描述
Now I want to judge whethe there is a field error for certain field(eg:user.username). I want to get the fieldError value then judge whether it is null,but I can't get the value of the field which name is "user.username". Please help me!Thank you so much!
解决方案
in ur java code, you can set ur error filed value like this:public class UserAction { public String login { this.addFieldError("user.username", "format error"); }}and in ur jsp page,write like this:<input type="text" name="user.username" /><s:fielderror> <s:param>user.username</s:param> </s:fielderror>
解决方案二:
<s:fielderror /> <s:fielderror> <s:param>field1 </s:param> show errmsg by field1 </s:fielderror>use <s:param> </s:param> to get your need.
时间: 2025-01-20 13:02:08