| Author |
getServletContext().getContent() returning null
|
Chandella Montero
Ranch Hand
Joined: Feb 18, 2011
Posts: 89
|
|
I have created two web applications to test getting the ServletContext of one application from within another application.
Code for the first Servlet, from the first application:
This will print the path "/MyServlets", which I will use in the second Servlet, as well as "from within the same servlet, flavour is: vanilla", which proves that this value has been set (I set it in the deployment descriptor).
Now here is the code for the second Servlet, which lives in the second application:
What am I doing wrong?
Thanks in advance for your help
|
OCA, OCP Java 6
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1042
|
|
Hi Chandella,
What am I doing wrong?
If you are using Tomcat as a server you have to put the following line in either the server.xml or better the context.xml of your server:
Regards,
Frits
|
 |
Chandella Montero
Ranch Hand
Joined: Feb 18, 2011
Posts: 89
|
|
Spot on, added that line to context.xml and it now works
Thank you ever so much, Frits!
|
 |
 |
|
|
subject: getServletContext().getContent() returning null
|
|
|