setting application variables
Hi, I'm very new to Tomcat and JSP. Can anybody tell me how I can initialize some application variables from a file so that they are available to all of the asp pages in my application as soon as it starts? Thanks!
RE: setting application variables
You could have a ContextListener for your web application. You could then read the properties from your property file and put them in the application context so that all your JSP pages have access to them. In order to implement a ContextListener you need to write a class that implements the ServletContextListener interface. You will have to make an entry in your web.xml about the same. Hope this helps, Mufaddal. -Original Message- From: Josh Howe [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 1:14 PM To: tomcat-user@jakarta.apache.org Subject: setting application variables Hi, I'm very new to Tomcat and JSP. Can anybody tell me how I can initialize some application variables from a file so that they are available to all of the asp pages in my application as soon as it starts? Thanks! -- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Consult your physician prior to the use of any medical supplies or product. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: setting application variables
I'll look into ContextListeners. Thanks! -Original Message- From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 4:16 PM To: Tomcat Users List Subject: RE: setting application variables You could have a ContextListener for your web application. You could then read the properties from your property file and put them in the application context so that all your JSP pages have access to them. In order to implement a ContextListener you need to write a class that implements the ServletContextListener interface. You will have to make an entry in your web.xml about the same. Hope this helps, Mufaddal. -Original Message- From: Josh Howe [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 1:14 PM To: tomcat-user@jakarta.apache.org Subject: setting application variables Hi, I'm very new to Tomcat and JSP. Can anybody tell me how I can initialize some application variables from a file so that they are available to all of the asp pages in my application as soon as it starts? Thanks! -- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Consult your physician prior to the use of any medical supplies or product. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: setting application variables
I can even save you some time: http://javawebparts.sourceforge.net There you will find an AppConfigListener that I think will do the trick nicely for you. Frank Josh Howe wrote: I'll look into ContextListeners. Thanks! -Original Message- From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 4:16 PM To: Tomcat Users List Subject: RE: setting application variables You could have a ContextListener for your web application. You could then read the properties from your property file and put them in the application context so that all your JSP pages have access to them. In order to implement a ContextListener you need to write a class that implements the ServletContextListener interface. You will have to make an entry in your web.xml about the same. Hope this helps, Mufaddal. -Original Message- From: Josh Howe [mailto:[EMAIL PROTECTED] Sent: Friday, July 29, 2005 1:14 PM To: tomcat-user@jakarta.apache.org Subject: setting application variables Hi, I'm very new to Tomcat and JSP. Can anybody tell me how I can initialize some application variables from a file so that they are available to all of the asp pages in my application as soon as it starts? Thanks! -- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Consult your physician prior to the use of any medical supplies or product. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: setting application variables
Look up context init-params and servlet init-params. I have some demo apps that demonstrate the use of these: http://simple.souther.us On Fri, 2005-07-29 at 16:14, Josh Howe wrote: Hi, I'm very new to Tomcat and JSP. Can anybody tell me how I can initialize some application variables from a file so that they are available to all of the asp pages in my application as soon as it starts? Thanks! -- Ben Souther F.W. Davison Co. CONFIDENTIALITY NOTICE: This e-mail message, and any accompanying documents, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, distribution or copying is prohibited. If you are not the intended recipient, please contact our office by email or by telephone at (508) 747-7261 and immediately destroy all copies of the original message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]