Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Putting Application with in another Application ??

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 24839
173
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Danger, 10,000 volts, very electic .... tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic