vaadin - 将参数传递给 vaadin 7 Web 应用程序

标签 vaadin vaadin7

我正在使用 vaadin6,所以我使用以下方法来检索 Web 应用程序参数:

public abstract class Application implements URIHandler,
        Terminal.ErrorListener, Serializable {

    /**
     * Searches for the property with the specified name in this application.
     * This method returns <code>null</code> if the property is not found.
     * 
     * See {@link #start(URL, Properties, ApplicationContext)} how properties
     * are defined.
     * 
     * @param name
     *            the name of the property.
     * @return the value in this property list with the specified key value.
     */
    public String getProperty(String name) {
        return properties.getProperty(name);
    }

    //...
}

迁移到 vaadin7 后,我想使用相同的功能,但找不到。

最佳答案

看来你在找

VaadinServlet.getCurrent().getServletContext().getInitParameter("name");

它授予对 web.xml 中定义的参数的访问权限,例如:

<context-param>
  <param-name>name</param-name>
  <param-value>John</param-value>
</context-param>

关于vaadin - 将参数传递给 vaadin 7 Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20774980/

相关文章:

javascript - 如何保证一个类永远不会暴露在 Vaadin 客户端

button - 如何指定一个按钮来打开一个 URL?

vaadin - 如何在没有按钮的情况下在 vaadin 中开始文件下载?

vaadin - 如何集中处理DataProvider方法中抛出的异常

java - 如何在 Vaadin 8 中从子线程获取访问 UI 线程

java - session 超时不起作用 vaadin

java - Jenkins - 构建 Vaadin Web 应用程序需要很长时间

java - 有没有办法只让 Vaadin 表的一行可编辑?

java - 菜单布局+一些静态和可切换内容

javascript - 如何使用 VaadinServlet 为图像设置 RequestHandler