File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Putting Application with in another Application ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Putting Application with in another Application ??" Watch "Putting Application with in another Application ??" New topic
Author

Putting Application with in another Application ??

Vijay Kashyap
Ranch Hand

Joined: Jul 30, 2001
Posts: 74
Hi All,
I am using Tomcat 4.01 as my WebServer. I am scratching my head if there is any way to add another application with in my current application so that I can work away without changing all the links in the added application.
Right now its pain in the neck to change all the links to avoid getting 404.
My current application structure is
main
jsp(main's jsps)
I want to add sub into this so it should look like
main
jsp (main's jsps)
sub
jsp
abc.jsp
def.jsp
In abc.jsp all my links refer to jsp's without any folder or application name. So the Tomcat tries to resolve it using the current application context like if I am using hyper-link def.jsp in abc.jsp, tomcat tries to find "http://myserver:8080/main/def.jsp" while I want it to look for "http://myserver:8080/main/sub/jsp/def.jsp".
The reason for doing this is to share the session information between these 2 different application. If they are put as 2 different application then I cannot share session information between them.
Could any body points out the easy and efficient way to achieve this, so that in future if I require to use sub as an independent application I have to make minimal changes.
Regards,
Vijay
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

For servlets, this is easy - you do the servlet mapping in web.xml. Whether this mechanism works for JSPs as well, I don't know without reading the docs, but it's not un unreasonable thing to expect.


Customer surveys are for companies who didn't pay proper attention to begin with.
Vijay Kashyap
Ranch Hand

Joined: Jul 30, 2001
Posts: 74
Tim,
Thanks for replying.
I am wondering that if I rely on web.xml for servlet mappings what would be the impact if later on I have to move my application to IIS or say some other Web Server.
Another question
Is it possible to forward a request to some other application on the same server?
Regards,
Vijay
Rishi Singh
Ranch Hand

Joined: Dec 09, 2000
Posts: 321
Hi,
you can share the session between two applications having two different servlet context all together.You need to use the HttpSessionActivationListener and call the sessionActivated/sessionPassivated once you migrate session.This should solve your problem of porting your application on a diffrent server.
whereas if don't want to do that and make it a part of the same context then u need to make the entry in the web.xml and set the document root accordingly
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Putting Application with in another Application ??
 
Similar Threads
multiple URL mapping for one web app
session variables in struts
JSP and Session Management
Requested resource is not available - how to correct
client cert authentication problem