我使用的是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之后,我想使用相同的功能,但是我找不到它。
发布于 2013-12-25 17:22:01
看来你是在找
VaadinServlet.getCurrent().getServletContext().getInitParameter("name");它允许访问web.xml中定义的参数,例如:
<context-param>
<param-name>name</param-name>
<param-value>John</param-value>
</context-param>https://stackoverflow.com/questions/20774980
复制相似问题