• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Access attribute of other Web Application

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible access atribute set in a web application e access in jsp and servlets of the other web Appliation in the same web Server ?
 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can have access to another ServletContext (other web application) by calling the instance method: ServletContext.getContext("pathOfOtherContext")
I'm not sure but I think that you have to do some additional configuration to have this working!!
maybe someone in the forum can tell us more about it...
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And, notice that servlet 2.4 documentation say nothing about set attributes in other contexts, it says about getting a javax.servlet.RequestDispatcher to the other context! and these application must be hosted in the same container!

Hope it helps!
 
Haroldo Nascimento
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is any possibility that ServletContext lost ou replace the attribute if others Users login in the Portal ?
Obs.: Every login I put in the ServletContext you Perfil.
Ask you because I know that session is per browser then I dont have this problem, but to put the Perfil on the ServletContext I dont know.
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Haroldo
Try to separate ServletContext and HttpSessions, ServletContext is the java representation of the application, and HttpSession is the java representation of a stateless session (statless protocol, HTTP). A session is just shared between contexts if you are inside a distributable application, also notice that the session will only transfer between context (the full object), there is no way to have parts of the session shared between containers, Take a look at HttpSessionActivationListener.
feel free to send me an e-mail, or a private message, in Portuguese if you preffer, maybe I can have more chances to help you using your native language (Portuguese isn't it?).
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am looking for similar thing to work.Can anyone be more clear on how I can make this work by maintaining the session for the servletcontext attributes....
 
Check your pockets for water buffalo. You might need to use this tiny ad until locate a water buffalo:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic