aspose file tools*
The moose likes Servlets and the fly likes -D option like when start a simple Java with init params Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "-D option like when start a simple Java with init params" Watch "-D option like when start a simple Java with init params" New topic
Author

-D option like when start a simple Java with init params

marko markovic
Greenhorn

Joined: Mar 16, 2001
Posts: 28
Hi,
i need to know if it is possible to use for JSP the same -D option like in java
java -Dtest=yes test
to set init parameters for JSP VM.
If yes how i can do this?
$Regards
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

IMO, it is NOT possible to use -D option for JSP's.
Sorry.....

regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Makro,
Do you want to setup some common init params for your web appln? If so we can configure ...WEB-INF/web.xml file like this. Include <context-param> xml tag under <web-app> xml tag. This means, all <param-name>'s are globally known in ALL servlets and ALL jsps in this particular web application.
To grab this init param values in servlets/ jsps just write this code.
String value = getServletContext().getInitParameter("webmaster");
regds
maha anna
marko markovic
Greenhorn

Joined: Mar 16, 2001
Posts: 28
I would do as in java with -D attribut then when i use System.getProperty(test) get the value of this parameter that i set when i do the java ....
it is important to me know if this is possible and how if is?
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
Yes, although it is server-dependent. In the .bat file that starts the JVM, you simply add the -Dvar=value entry on that line.
If you are using Tomcat 3.x, you can set the TOMCAT_OPTS environment variable to "-Dvar=value" before running startup.bat. Tomcat 4.0 has a similar variable CATALINA_OPTS.
------------------
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets


Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
marko markovic
Greenhorn

Joined: Mar 16, 2001
Posts: 28
it's work Thanks a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: -D option like when start a simple Java with init params