I've got two files, a jsp page and a java file in the background.
The jsp file calls a method in the java file as shown below
The java file the calls another method as shown below. servlet in the parameters is the "application" value passed from the jsp page.
Within checkLogin, i try to get the context for an application as shown below. "context" below is the result of servlet.getServletContext() in teh call.
For some reason crmsAuthContext is always null and im not sure why. The way the application is structured in Tomcat is that it is deployed in multiple war files as shown below.
The above code is from the /core application and i am trying to call something from the /admin application. Whenever i try to get the context of /admin it return null. Can anyone help?
Originally posted by seetharaman venkatasamy:
you already pass servletContext into java class
UserAuth userauth = Login.checkLogin(application, request, response, null);
then once again why you want to access...you can use the application right?...
correct me ,if i am wrong
It is passed from a jsp page as "application" to a servlet. the servlet that recieves it uses it by passing it to another method using servlet.getServletContext(). The method that recieves it uses it to access the actual context using context.getContext("/admin")
I added the above code into a file called called admin.xml and placed the file in $CATALINA_HOME/conf/Catalina/localhost/admin.xml
I also tried to put the code into a file called context.xml and placed it in $CATALINA_HOME/webapps/admin/META-INF
I also tried to add the above code in $CATALINA_HOME/conf/server.xml
None of the above options worked.