Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Putting Application with in another Application ??

 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vijay Kashyap
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic