wood burning stoves 2.0*
The moose likes Tomcat and the fly likes How to access a context.xml parameter? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to access a context.xml parameter?" Watch "How to access a context.xml parameter?" New topic
Author

How to access a context.xml parameter?

James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
I want to test my context.xml file is being read.

If I put this line in context.xml...

...what code could I use in a servlet that would return "testValue"?

Thanks,
James
Praneeth Yeri
Greenhorn

Joined: Oct 07, 2010
Posts: 11
you should use a parser for this like jaxb . most simple way is to use as context param in web.xml file
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

James Hodgkiss wrote:I want to test my context.xml file is being read.

If I put this line in context.xml...

...what code could I use in a servlet that would return "testValue"?

Thanks,
James
Is this a test for front end? Wich framewor are you using?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
Thanks for the replies.

To repeat, I ask the question as a means of testing if my context.xml file is being read by Tomcat, so moving the test name/value to web.xml wouldn't be of any benefit.

I am not using a framework. I am wanting to perform this test as I am having a JNDI connection pool problem with the woefully substandard godaddy java hosting (Tomcat 5.0.27).
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61238
    
  66

As this is Tomcat-speciifc, moved to the Tomcat forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
Solution: The parameter can be read in the normal way from the servlet context:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access a context.xml parameter?