我正在使用 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/