Let's say you write a Deployment Descriptor with some context parameters and you want one of them to be an object,unfortunatelly I read that you cand only add string values to the tag.
Is there a way to do this?I understood an example when it came to a database because you can put the look-up name.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ....>
<context-param>
<param-name>foo</param-name>
<param-value>new foo()</param-value>
<servlet>
<servlet-name>BeerParamTests</servlet-name>
<servlet-class>TestInitParams</servlet-class>
<init-param>
<param-name>adminEmail</param-name>
<param-value> likewecare@wikewdfs</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>BeerParamTests</servlet-name>
<url-pattern>/Tester.do</url-pattern>
</servlet-mapping>
<context-param>
<param-name>foo</param-name>
<param-value>com.edu.Foo</param-value>
</context-param>
In you java code, try the below
Class.forName(getServletContext().getInitParameter("foo")).newInstance();
but you will get only the empty object without any values assigned to the properties. will it work for you?