Vaadin 更改默认会话过期通知? [英] Vaadin Change the default Session Expired Notification?
本文介绍了Vaadin 更改默认会话过期通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
瓦丁 7.6.2
如何更改默认的会话过期通知;消息和通知类型?
How to change the default Session Expired Notification; both the message and the type of notification?
推荐答案
要更改会话过期消息,您需要创建自己的 SystemMessagesProvider
,您可以在其中定义它.例如,在 servlet 部署中,您可以执行以下操作:
To change session expired message you need to create your own SystemMessagesProvider
, where you define it. For example in a servlet deployment, you could do the following:
@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false)
public static class MyUIServlet extends VaadinServlet {
@Override
protected void servletInitialized() throws ServletException {
super.servletInitialized();
CustomizedSystemMessages messages = new CustomizedSystemMessages();
messages.setSessionExpiredCaption("Session expired caption");
messages.setSessionExpiredMessage("Session expired more detailed message");
getService().setSystemMessagesProvider(e -> messages);
}
}
没有改变通知类型的内置方法.当然,您可以使用 css 设置样式,但样式也会影响其他系统通知.
There is no a built-in way to change the type of notification. Of course you can style it with css, but the styling affects to other system notifications as well.
这篇关于Vaadin 更改默认会话过期通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文