Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You mention that you're trying to see the same information between two browsers... if the information you're trying to share is "global" (i.e. it should be the same for ALL users of the application, you should store the information in the application scope, not the session scope. (see <a href="http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html#JSPIntro5" rel="nofollow noreferrer">http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html#JSPIntro5</a> for explanation of scopes). For example:</p> <pre><code>ServletContext servletContext = getServlet().getServletContext(); //"application scope" SomeObjectClass object = (SomeObjectClass) servletContext.getAttribute("objectName"); if(object !=null){ //Do this } else { //Do that } </code></pre> <p>If you have accounts and a login mechanism and you're wanting the same login to see the same information in two different browsers, then you have a different issue. In that case the information will need to be stored in a "database" (not necessarily a rdbms, could be the application scope!, depending on your needs for persistence) and the information would need to be retrieved in the action class using the user information that could be stored in the session, cookie, etc.</p> <pre><code>//get the user info from the session, cookies, whatever UserInfoObject userInfo = getUserInfo(request); //get the object from the data store using the user info SomeObjectClass object = getObjectForUser(userinfo); if(object !=null){ //Do this } else { //Do that } </code></pre>
 

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