reading config parameter from web.xml

Hi,

I am new to vaadin (and web programming in general), and am looking for a way to read a configured path from a config file. Searching on the internet seems to suggest the way to do this is use web.xml and store the parameter as an , however my application doesn’t seem to get the correct value

I am using the following entry in the web.xml:

SimplevaadinserverUI

com.vaadin.server.VaadinServlet

<init-param>
  <param-name>configFilePath</param-name>
  <param-value>/Path/To/XML/File.xml</param-value>
</init-param>

In the vaadin server application I have tried the following approaches:

DeploymentConfiguration conf = getSession().getConfiguration();
String configFilePath = conf.getApplicationOrSystemProperty(“configFilePath”, “default/path/of/File.xml”);

This always gives me the default, instead of the value in the xml that I am looking for.

  1.         String configFilePath = VaadinServlet.getCurrent().getInitParameter("configFilePath");
    

I get null for this.

Can anyone help with this?

Hi,

in my project i read from my web.xml like this:

String example = VaadinServlet.getCurrent().getServletContext().getInitParameter("example"); web.xml:

  <context-param>
    <param-name>example</param-name>
    <param-value>myvalue</param-value>
  </context-param>

Thanks a ton. That fixed the problem.