Note that there are some explanatory texts on larger screens.

plurals
  1. POsharing session in web applications
    primarykey
    data
    text
    <p>I am developing A Web Application using <code>JSP</code> &amp; <code>Servlets</code> (Container: <code>Tomcat7</code>, Database: <code>Oracle10</code>)</p> <p>I have developed some web applications like <code>Profile</code>, <code>Reports</code>, <code>Leads</code>. Then I have developed A <code>Login</code> application. In this application I am storing <em>USERID</em> in <code>Session</code> with some more session attributes.</p> <p>After user logs in he will be shown menu which contains links to other Applications like links to <code>Profile</code> Application.</p> <p>So when I access <code>Session</code> after user log in:</p> <ul> <li>If I try to access session withing the same application(Login) then I get session with all the required attributes</li> <li>But when I try to access session from other applications like <code>Profiles</code> then I get session as <code>null</code></li> </ul> <p><strong>code snippet to check session</strong> (Servlet Filter in Login web application)</p> <pre><code>HttpSession session = request.getSession(false); if(session==null) { System.out.println("Session does not exist... Redirected to LOGIN Page."); response.sendRedirect("/ApplicationName/Login.jsp"); } </code></pre> <p>I am accessing session in <code>Profile</code> application to check whether user is logged in or not.</p> <p>Then I have searched, and I have found that <code>Session</code> can't be accessed from other applications for security reasons.(I have also found that it can be done by setting <code>crossContext="true"</code>)</p> <p>Then I have found other option like making <code>EAR</code> of all applications and then deploy it, but unfortunately <code>EAR</code> it is not supported by <code>Tomcat7</code>.</p> <p>I am new to web environment, so if anyone has worked on this before then please let me know what can be the options?</p> <p>Thanks in advance</p> <p><strong>Update1</strong></p> <p>Now I have decided to use <code>EAR</code>, in which I will pack all <code>WAR</code> files and then I will try to share session between them. since Tomcat doesn't support <code>EAR</code> I have installed <code>Oracle Glassfish</code>, Then I have created <code>Enterprise Application Project</code> which contains two Applications <code>1. Login</code> and <code>2. Profiles</code>, and then created <code>EAR</code> file, and deployed it on <code>Glassfish</code>. So I want to share session between those two applications(on Glassfish), so if anybody has any idea about it then please let me know. (link to any tutorial will also be appreciated)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload