RE: Default Servlet Parameters
--- Shapira, Yoav [EMAIL PROTECTED] wrote: If you want some params common to all the servlets in your web-app, use context-param instead, outside your servlet tags. Somehow this isn't working for me. The context-param tags are ignored and the init-param is read instead: *** myApp/WEB-INF/web.xml *** web-app context-param param-namemyParam/param-name param-valuemyValue/param-value /context-param servlet servlet-namemyServlet/servlet-name servlet-classpathto.myServlet/servlet-class init-param param-namefunky/param-name param-valuetown/param-value /init-param /servlet /web-app *** myApp/WEB-INF/classes/myServlet.java *** public myServlet { ... Enumeration parameterNames = config.getParameterNames(); while( parameterNames.hasMoreElements() ) { System.out.println(parameterNames.nextElement()); } } *** OUTPUT *** funky __ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Default Servlet Parameters
On Wed, 10 Jul 2002, Manchan wrote: Date: Wed, 10 Jul 2002 11:32:45 -0700 (PDT) From: Manchan [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: RE: Default Servlet Parameters --- Shapira, Yoav [EMAIL PROTECTED] wrote: If you want some params common to all the servlets in your web-app, use context-param instead, outside your servlet tags. Somehow this isn't working for me. The context-param tags are ignored and the init-param is read instead: If you want to read context init parameters instead of servlet init parameters, you have to do so: Enumeration parameterNames = config.getServletContext().getParameterNames(); ... Craig *** myApp/WEB-INF/web.xml *** web-app context-param param-namemyParam/param-name param-valuemyValue/param-value /context-param servlet servlet-namemyServlet/servlet-name servlet-classpathto.myServlet/servlet-class init-param param-namefunky/param-name param-valuetown/param-value /init-param /servlet /web-app *** myApp/WEB-INF/classes/myServlet.java *** public myServlet { ... Enumeration parameterNames = config.getParameterNames(); while( parameterNames.hasMoreElements() ) { System.out.println(parameterNames.nextElement()); } } *** OUTPUT *** funky __ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Default Servlet Parameters
Howdy, You shouldn't be giving other parameters to tomcat's own DefaultServlet. Your own servlets have no limitations on the number of name of variables: you can have as many init-param tags in your servlet tags as you want. If you want some params common to all the servlets in your web-app, use context-param instead, outside your servlet tags. Yoav Shapira Millennium ChemInformatics -Original Message- From: Manchan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 02, 2002 4:44 PM To: [EMAIL PROTECTED] Subject: Default Servlet Parameters *** THE QUESTION *** I'd like to load global init parameters for my servlets on Tomcat, in the manner which Jserv accomplishes with its |zone.properties| file using the line |servlets.default.initArgs=myParameter=myValue|. *** MY GUESS TO QUESTION *** I presume the Tomcat analogue to the above is adding init-param tags to $TOMCAT/conf/web.xml, e.g. servlet servlet-namedefault/ servlet-classorg.path.to.DefaultServlet/ init-param param-namemyParameter/ param-valuemyValue/ /init-param /servlet *** UNFORTUNATELY *** In DefaultServlet.java, it statically loads only five init-parameters, namely debug, input, listings, output, readonly. I would need to alter Tomcat code to accept |myParameter|. There must be a better way. __ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Default Servlet Parameters
I have a supplementary question to this. Is there any accepted way to pass parameters to servlets/jsps that may be edited? I can see that init-param context-param do what I want but I need to allow a user to change values of some parameters, save them and the new values would be used subsequently. I don't want to have my code re-writing web.xml or server.xml. I guess I could have a context parameter pointing to an OS file that would contain parameter sets in XML or java property sets. Any other approaches? Oh, that's another question. Any common software out there that can easily parse an XML property file or can I use some of the tomcat libraries? - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, July 08, 2002 2:33 PM Subject: RE: Default Servlet Parameters Howdy, You shouldn't be giving other parameters to tomcat's own DefaultServlet. Your own servlets have no limitations on the number of name of variables: you can have as many init-param tags in your servlet tags as you want. If you want some params common to all the servlets in your web-app, use context-param instead, outside your servlet tags. Yoav Shapira Millennium ChemInformatics -Original Message- From: Manchan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 02, 2002 4:44 PM To: [EMAIL PROTECTED] Subject: Default Servlet Parameters *** THE QUESTION *** I'd like to load global init parameters for my servlets on Tomcat, in the manner which Jserv accomplishes with its |zone.properties| file using the line |servlets.default.initArgs=myParameter=myValue|. *** MY GUESS TO QUESTION *** I presume the Tomcat analogue to the above is adding init-param tags to $TOMCAT/conf/web.xml, e.g. servlet servlet-namedefault/ servlet-classorg.path.to.DefaultServlet/ init-param param-namemyParameter/ param-valuemyValue/ /init-param /servlet *** UNFORTUNATELY *** In DefaultServlet.java, it statically loads only five init-parameters, namely debug, input, listings, output, readonly. I would need to alter Tomcat code to accept |myParameter|. There must be a better way. __ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Default Servlet Parameters
I don't like to store parameters in web.xml because many application servers require applications to be redeployed to take in account change in these files. I prefer to put there path to configuration files. Take in account not all application servers expand war files... Andre POWROZNIK -Original Message- From: Mark O'Driscoll [mailto:[EMAIL PROTECTED]] Sent: 08 July 2002 15:49 To: Tomcat Users List Subject: Re: Default Servlet Parameters I have a supplementary question to this. Is there any accepted way to pass parameters to servlets/jsps that may be edited? I can see that init-param context-param do what I want but I need to allow a user to change values of some parameters, save them and the new values would be used subsequently. I don't want to have my code re-writing web.xml or server.xml. I guess I could have a context parameter pointing to an OS file that would contain parameter sets in XML or java property sets. Any other approaches? Oh, that's another question. Any common software out there that can easily parse an XML property file or can I use some of the tomcat libraries? - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, July 08, 2002 2:33 PM Subject: RE: Default Servlet Parameters Howdy, You shouldn't be giving other parameters to tomcat's own DefaultServlet. Your own servlets have no limitations on the number of name of variables: you can have as many init-param tags in your servlet tags as you want. If you want some params common to all the servlets in your web-app, use context-param instead, outside your servlet tags. Yoav Shapira Millennium ChemInformatics -Original Message- From: Manchan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 02, 2002 4:44 PM To: [EMAIL PROTECTED] Subject: Default Servlet Parameters *** THE QUESTION *** I'd like to load global init parameters for my servlets on Tomcat, in the manner which Jserv accomplishes with its |zone.properties| file using the line |servlets.default.initArgs=myParameter=myValue|. *** MY GUESS TO QUESTION *** I presume the Tomcat analogue to the above is adding init-param tags to $TOMCAT/conf/web.xml, e.g. servlet servlet-namedefault/ servlet-classorg.path.to.DefaultServlet/ init-param param-namemyParameter/ param-valuemyValue/ /init-param /servlet *** UNFORTUNATELY *** In DefaultServlet.java, it statically loads only five init-parameters, namely debug, input, listings, output, readonly. I would need to alter Tomcat code to accept |myParameter|. There must be a better way. __ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] DISCLAIMER This e-mail and any attachments thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Default Servlet Parameters
How about just using a Properties object (java.util.Properties)? Setup a default configuration file, it doesn't have to be server.xml or web.xml. Make it something like myapp.conf or whatever. Then read that file in on startup, creating a Properties object with the values. You could write the file back out as a stream, or just keep the changes around for that particular session. John Turner [EMAIL PROTECTED] -Original Message- From: Mark O'Driscoll [mailto:[EMAIL PROTECTED]] Sent: Monday, July 08, 2002 9:49 AM To: Tomcat Users List Subject: Re: Default Servlet Parameters I have a supplementary question to this. Is there any accepted way to pass parameters to servlets/jsps that may be edited? I can see that init-param context-param do what I want but I need to allow a user to change values of some parameters, save them and the new values would be used subsequently. I don't want to have my code re-writing web.xml or server.xml. I guess I could have a context parameter pointing to an OS file that would contain parameter sets in XML or java property sets. Any other approaches? Oh, that's another question. Any common software out there that can easily parse an XML property file or can I use some of the tomcat libraries? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Default Servlet Parameters
On Mon, 8 Jul 2002, Mark O'Driscoll wrote: Date: Mon, 8 Jul 2002 14:48:49 +0100 From: Mark O'Driscoll [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: Default Servlet Parameters I have a supplementary question to this. Is there any accepted way to pass parameters to servlets/jsps that may be edited? I can see that init-param context-param do what I want but I need to allow a user to change values of some parameters, save them and the new values would be used subsequently. I don't want to have my code re-writing web.xml or server.xml. I guess I could have a context parameter pointing to an OS file that would contain parameter sets in XML or java property sets. Any other approaches? A properties file pointed at by an initialization parameter is the most common approach. Another option is to make your configuration settings things in the database that a user can edit through admin-type screens in your webapp. Oh, that's another question. Any common software out there that can easily parse an XML property file or can I use some of the tomcat libraries? Check out the Digester package at Jakarta Commons. It's what Tomcat (4.1.x and later) uses to parse server.xml and web.xml files, and it's also used by many other applications (such as Struts) for the same reason. http://jakarta.apache.org/commons/digester/ Craig - Original Message - From: Shapira, Yoav [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, July 08, 2002 2:33 PM Subject: RE: Default Servlet Parameters Howdy, You shouldn't be giving other parameters to tomcat's own DefaultServlet. Your own servlets have no limitations on the number of name of variables: you can have as many init-param tags in your servlet tags as you want. If you want some params common to all the servlets in your web-app, use context-param instead, outside your servlet tags. Yoav Shapira Millennium ChemInformatics -Original Message- From: Manchan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 02, 2002 4:44 PM To: [EMAIL PROTECTED] Subject: Default Servlet Parameters *** THE QUESTION *** I'd like to load global init parameters for my servlets on Tomcat, in the manner which Jserv accomplishes with its |zone.properties| file using the line |servlets.default.initArgs=myParameter=myValue|. *** MY GUESS TO QUESTION *** I presume the Tomcat analogue to the above is adding init-param tags to $TOMCAT/conf/web.xml, e.g. servlet servlet-namedefault/ servlet-classorg.path.to.DefaultServlet/ init-param param-namemyParameter/ param-valuemyValue/ /init-param /servlet *** UNFORTUNATELY *** In DefaultServlet.java, it statically loads only five init-parameters, namely debug, input, listings, output, readonly. I would need to alter Tomcat code to accept |myParameter|. There must be a better way. __ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com -- To unsubscribe, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] For additional commands, e-mail: mailto:tomcat-user- [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Default Servlet Parameters
*** THE QUESTION *** I'd like to load global init parameters for my servlets on Tomcat, in the manner which Jserv accomplishes with its |zone.properties| file using the line |servlets.default.initArgs=myParameter=myValue|. *** MY GUESS TO QUESTION *** I presume the Tomcat analogue to the above is adding init-param tags to $TOMCAT/conf/web.xml, e.g. servlet servlet-namedefault/ servlet-classorg.path.to.DefaultServlet/ init-param param-namemyParameter/ param-valuemyValue/ /init-param /servlet *** UNFORTUNATELY *** In DefaultServlet.java, it statically loads only five init-parameters, namely debug, input, listings, output, readonly. I would need to alter Tomcat code to accept |myParameter|. There must be a better way. __ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]