I need to read database properties from server.xml and need this information on load of the page.How do I acheive it in G开发者_开发百科WT ?
I am not sure if there is anything specific to GWT. But I guess you could use
Servlet.getResourceAsStream
Or if you use JSP, you could use the application
implicit object to get the ServletContext
and you can use getResourceAsStream
Some pointers here and here
In your onModuleLoad() call an RPC through a
DeferredCommand.addCommand(new Command() {
public void execute () {
getDBParameters();
}
}
where getDbParameters is a method that populates the values for you by calling an RPC.
See http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html for how to communicate with server.
On the Server side just have your RPC return a HashMap of properties and read those.
精彩评论