对于输入的数据类型错误,struts2会自动生成fielderror提醒,也可以自定义自己的错误提醒

关键步骤:

  • 在Action的相同目录下建立properties文件

struts2_自定义错误提示

proterties的文件名格式为Action类名.properties

  • 编写properties文件

 

struts2_自定义错误提示

invalid.fieldvalue为固定格式,age为属性名,age invalid!!为提示信息

 

 

struts2_自定义错误提示

 

相关文章:

  • 2022-01-04
  • 2021-05-22
  • 2021-11-09
  • 2021-05-06
  • 2022-12-23
  • 2021-12-12
  • 2022-02-04
  • 2021-12-12
猜你喜欢
  • 2022-12-23
  • 2021-09-13
  • 2021-09-27
  • 2021-08-07
  • 2021-09-21
  • 2021-10-23
  • 2021-04-12
相关资源
相似解决方案