You must override the init method:
public class GreetingServiceImpl extends RemoteServiceServlet
implements GreetingService {
private String strHost;
public void init(ServletConfig config) throws ServletException {
super.init(config);
String strHost = config.getServletContext().getInitParameter("dbHost");
}
}
-Manolo
On Mon, May 31, 2010 at 10:53 AM, MickeyMiner
<[email protected]> wrote:
> Hi,
>
> How do I read parameters stored in /WEB-INF/web.xml from my
> GreetingServiceImpl class?
>
> After I insert following snipplet int web.xml:
>
> <init-param>
> <param-name>dbHost</param-name>
> <param-value>192.168.120.120</param-value>
> </init-param>
> <init-param>
> <param-name>dbName</param-name>
> <param-value>my_database</param-value>
> </init-param>
>
> Is anything like this possible:
>
> public class GreetingServiceImpl extends RemoteServiceServlet
> implements GreetingService {
> public String greetServer(String input) throws
> IllegalArgumentException {
> Series<Parameter> parameters = getContext().getParameters();
> String strHost = parameters.getFirstValue("dbHost");
> String strName = parameters.getFirstValue("dbName");
> return "The target database is " + strName + "@" + strHost;
> }
> }
>
>
> Thanx for your help and cheers!
>
> mm
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.