How to pass System Properties in web.xml
In Java standalone application, you can use -D
option to pass in the system properties :
$ java -Dgeoip.file="/home/mkyong/geoip/test.db" test.jar
In Java web application, you can pass the system properties via context-param
in web.xml
:
web.xml
<web-app>
<context-param>
<param-name>geoip.file</param-name>
<param-value>/home/mkyong/geoip/test.db</param-value>
</context-param>
</web-app>
hi, is there anyway to use -Dgeoip.file jvm parameter inside web.xml? I mean something like:
$ java -Dgeoip.file=”/home/mkyong/geoip” test.jar
geoip.file
${geoip.file}/test.db
this example is not running ok.
i all ways love reading mkyong.com examples . thank u yong garu ,i never for got u ,u are very great man.
i said to my friends if u have any doughts sees mkyong.com.
please keep good examples and enhancement real time senarios.
and also keep WebService programs each and every topic.
like java web based ,interacting with database and using web service to communicate with other java web app having strong stuff.
Great, thanks, very succinct