Howdy, >I'm trying to do something as simple as define global constants for my JSP >application. In ASP there is a Global.asa file and the closest thing in JSP >is of course the web.xml file. I defined a value in my web.xml file and >assumed I could retrieve it using the following line: > >String test = (String) new InitialContext().getAttribute("html.basepath"); > >I've done something similar for Datasources that works just fine but for >some reason tyring to retrieve a basic String in a similar manner doesn't >work. > >Can someone please tell me what I am missing?
You're missing a lot. You should read the Servlet Specification, specially the section on context parameters (context-param elements in web.xml), which is what you will probably use for simple strings. You should read the JNDI documentation for what a context (including InitialContext) is. It doesn't have a getAttribute method, so I seriously doubt this line of code even compiles, much less works for datasources or any other type of JNDI resource. You could use a JNDI context for simple strings, but that's usually overkill. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]