• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access a context.xml parameter?

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64621
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this is Tomcat-speciifc, moved to the Tomcat forum.
 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solution: The parameter can be read in the normal way from the servlet context:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic