关于在 Struts 1 中抛出/显示用户友好的错误消息,是否有任何有用的模式或最佳实践?
if(something nasty...) {
throw new UserException("very bad thing happened");
} else if(something other nasty...) {
throw new UserException("other thing happened");
} .... other 100 cases
因为在 validate() 方法中一遍又一遍地使用上面的示例似乎有点多余和不专业。
最佳答案
创建 ActionMessage 并显示它们。 这里有比我能给你的更好的信息: http://www.mkyong.com/struts/struts-logic-messages-present-logic-messages-notpresent-example/
关于java - 在java struts中抛出自定义错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29389738/