我已经使用 Struts2 框架实现了客户端验证机制,但是当发生错误时,属性文件中的 ${getText(fieldName)}
变量显示为空,例如,它显示为 "The field is required"
而不是 "The field username is required"
我在属性文件中有这个:
errors.required=Field ${getText(fieldName)} is required.
最佳答案
只需在属性文件中定义键值pare
username=username
假设 username
是 -validation.xml
中的 fieldName
关于java - ${getText(fieldName)} 在客户端验证中不显示任何内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15935002/