简体   繁体   English

呈现特定于组件的错误消息的最佳方法是什么?

[英]What's the best way of rendering component specific error messages?

I need a general way of rendering a component specific error message right next to the component which caused it. 我需要一种在导致错误的组件旁边呈现特定于组件的错误消息的通用方法。 Up to now I've used a Feedback panel, which isn't ideal if the page contains multiple components, requiring the user to scroll down the page. 到目前为止,我已经使用了“反馈”面板,如果页面包含多个组件,这是不理想的,这要求用户向下滚动页面。 Also, if you place multiple Feedback panels on the page, they all display the same message. 另外,如果您在页面上放置多个“反馈”面板,它们都将显示相同的消息。 Is there a general way of rendering localised error messages near a specific component? 是否存在在特定组件附近呈现本地化错误消息的一般方法?

You can place multiple feedback panels on a page with different sets of messages. 您可以在页面上放置多个带有不同消息集的反馈面板。 The FeedbackPanel class has a constructor that takes an IFeedbackMessageFilter , and you can create your own implementations of this filter to limit the messages that will show. FeedbackPanel类具有一个接受IFeedbackMessageFilter的构造函数,您可以创建此过滤器的自己的实现,以限制将显示的消息。

To more completely localize your messages to appear next to the related form components, you can use a FormComponentFeedbackBorder . 要更完全地本地化要显示在相关表单组件旁边的消息,可以使用FormComponentFeedbackBorder A good example of combining these to make a form show messages in a regular feedback panel but also highlight the bad fields is shown in this blog post . 在此博客文章中显示了一个很好的例子,可以将这些结合起来以使表单在常规反馈面板中显示消息,同时突出显示不良字段。

There is an Excellent Blog post on this subject from a few years back. 几年前,有一篇关于该主题的优秀博客文章。
That details how to have error messages show up next to the component that reported the error. 这详细说明了如何使错误消息显示在报告错误的组件旁边。

http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket http://stuq.nl/weblog/2008-09-03/user-friendly-form-validation-with-wicket

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 出错时终止程序的最佳方法是什么? - What's the best way to terminate a program on error? 将单个@Component实例转换为多个实例的最佳方法是什么? - What's the best way to turn a single @Component instance into multiple ones? 从非骆驼组件向骆驼组件发送消息的最佳方法是什么? - What's the best way to send a message to a Camel Component, from a non Camel component? 处理此“ try-error-clean -retry”情况的最佳方法是什么? - What's the best way to handle this “try - error - clean -retry” case? 调试改进错误消息的最佳方法 - The Best Way to Debug Retrofit Error Messages 处理/处理错误流消息的最佳方法 - Best way to process/handle Error stream messages 在spring和springboot中,从src代码中外部化错误消息(资源包)的最佳方法是什么? - What is best way to externalize error messages(resource bundles) out of src code in spring and springboot? 从 url 字符串中删除特定参数的最佳方法是什么? - What's the best way to get rid of specific parameter from url string? 在MVC应用中将日志消息分组的最佳方法是什么 - What is the Best way to group log messages in a MVC app 将消息从服​​务器传递到html(GUI)的最佳方法是什么 - what is the best way to pass messages from server to html (GUI)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM