Attribute « Session « Java Enterprise Q&A





1. May have a memory leak in Java webapp - have question about garbage collection and session attributes    stackoverflow.com

I've been profiling my webapp locally on my pc with VisualVM. I'm pretty certain that I have a small memory leak. After taking a snapshot of the application, I chose the ...

2. Case sensitivity in Session Attributes    stackoverflow.com

Is there case sensitivity in session attributes?

request.getSession().getAttribute("Contract");

request.getSession().getAttribute("contract");

6. Is session attribute thread-safe?    coderanch.com

If I visit the same web application across two browser windows simultaneity, there will be two threads visiting the web application. But I don't know whether the two threads share the same session? If they share, the session attribute is not thread-safe. If they do not share, the session attribute is thread-safe. who can explain it to me?

7. active session loses attribute    coderanch.com

Hi, The problem is that an active session loses an attribute without explicitly removing it by setting it to null. Here's how and when it happens: An apache web server runs an index html file. This file has a link to a servlet: upon clicking, the call is redirected to a second, Tomcat server that hangs behind the apache server and ...

8. Session Attributes Disappear!!    coderanch.com

We are experiencing this really weird phenomenon. We are working on a J2EE application that uses Tomcat 4.1.18 and runs on a Windows 2000 Server. We are getting a lot of Null Pointer Exceptions on the production side and when we look at Tomcat logs, we notice that a lot of these errors stem from retrieving null attributes from the session. ...

9. Losing session attribute    coderanch.com

There's nothing going wrong. Browser's bind cookies to the domain from were they come. When you logged into localhost you started one session. Then you loggedn with the IP number and your browser started a new one. The browser has no way of knowing that localhost resolves to that particular IP. As far as it's concerned they are two different sites ...





10. Is it a good idea to invalidate a session or remove attribute to save resource ?    coderanch.com

I'm thinking that after I use "session" to carry objects among several JSP pages, after I reach the final result page, maybe I should do something like "invalidate" the session or just remove those attributes stored in session, this should free some resources everytime. But the consequence will be --- if I click "back" button to go back to the middleway ...

12. Session Attribute Question    coderanch.com

13. session attribute availability    coderanch.com

15. session attributes type    coderanch.com

16. return a specific session attribute from HttpSessionListener    coderanch.com

Hello all, I have a HttpSessionListener that works fine. I can get it to return a active session count and also each session ID. public class MySessionListener implements HttpSessionListener{ private static int sessionsCreated = 0; public void sessionCreated( HttpSessionEvent se ) { sessionsCreated++; System.out.println("Now " + sessionsCreated + " active sessions"); HttpSession session = se.getSession(); System.out.println("MY SESSION = "+session.getId()); } public ...





18. Array as session attribute    coderanch.com

19. Will my session attributes travel to the front end    coderanch.com

In my application i create multiple sessions. I am adding some attributes which are objects of type MyClass,File,MyDatabase. Will all the objects available in the session travel to the client and then to the server for all the requests and response? or only the session Id travels to the client and the server manages all other objects with itself till the ...

20. Session Attribute    coderanch.com

21. Are Session attributes thread safe?    coderanch.com

Two browsers does not necessarily mean two sessions. MSIE, for instance, behaves differently depending on how you open the second window. If you use the Windows Start button to open a new instance, you will get an instance with it's own cookie space. If, on the other hand, you use Ctrl+N or the File -> new menu option from within MSIE, ...

22. Exception with session attribute.    coderanch.com

Originally posted by Ben Souther: HttpSession session = request.getSession(); if(session.isNew()){ session.setAttribute("RequestCount", new Integer(0)); } In apps that are a mixture of servlets and JSPs, there is a good chance that the session will not be new when your servlet gets to it. (JSPs by default, create a session). One possible problem I could see with this (but we will never know ...

23. Session Attribute    coderanch.com

Depending upon which browser you are using and how the browser instances are created, the browser instances may share cookies. Since sessions are maintained by an id value stored as a cookie, this means that any instances that share cokkies will share the session. [ November 04, 2007: Message edited by: Bear Bibeault ]

24. When does a Session Attribute loose Its Value    coderanch.com

If I assign a session attribute a value when does this session attribute loose its value? I have a strange thing happening. When the user chooses a selection fro a list a value is assigned to a session attribute. At some point in time when the app tries to session.getattribute it returns null. If the session attribute is set then the ...

25. how to use session attribute    coderanch.com

Hello frnds, I have customerlogin page (has username and password) and that linked to customerservice page and this one linked to change profile page(contains change password, change name, change phone no.) So using session attribute how to set that username so that in change profile page i want to get that username. Reply soon

26. Strange Session Attribute Behavior    coderanch.com

I call a servlet and set a session attributes, it then calls a jsp(menu page), next I click a menu item to call a servlet which uses the afore mentioned attributes but it acts like they don't exist, well sometimes. We have a local intranet which contains a company page containing links to my web apps. The above happens when a ...

27. Check that a session attribute exists    coderanch.com

28. How to Clear unused Session Attributes    coderanch.com

29. Session Attribute value Ertatic    coderanch.com

From my doGet of the servlet I have: GetUserPrefs gupConn = new GetUserPrefs(); gupConn.setUserPrefs(p0, gConn.getAs400Conn()); My Class: public class GetUserPrefs { private String errorString; private String deptdefault; private String userp2; private String userp3; private String userp4; private String userp5; public GetUserPrefs() { } public void setUserPrefs(String arg0, Connection arg1){ try{ this.deptdefault = ""; this.userp2 = ""; this.userp3 = ""; Statement stmt ...

30. Life cycle fo session attributes    coderanch.com

Hi I am using session atttibutes to know whether a user is loged in or not.Basically what i am doing is i am authenticating user with database and if user's username and password are correct, then in the sevlet i am setting a string to yes value and checking that condition where ever required in the application.But in some pages of ...

31. Session Attribute and Date Function    coderanch.com

32. Which would be better - Session Attribute or Session Bean    coderanch.com

I have a number of basic pieces of information regarding each user that logs into my system: fname (user's firstname) lang (id of the language they want to view the page in) email (obvious) log_time (date/time logged in) I can't find any clear answer to this (maybe there isn't one), which is better to use, a Session Bean (standard java not ...

33. Get session attribute values from all activated session's    coderanch.com

Hi, i want to monitor all (Active) available sessins in my web application. Its possible in HttpSessionListener but i need to get the attribute values from all sessions how is it possible. here is the code for getting available sessions public class ListenerDemo1 implements HttpSessionListener { private static Map sessions = new HashMap(); public void contextInitialized(ServletContextEvent e) { e.getServletContext().setAttribute("sessionList", new ArrayList()); ...

34. Setting and removing session attributes - is this the right way to do this?    coderanch.com

I have a web application with a 'request' form. When a user fills out the form and submits it, if it fails validation (either front-end javascript validation or back-end servlet validation), I'd like to keep the values they already entered so they don't have to re-type the data in. I set session attributes in my servlet to retain these values. However, ...

36. Getting Reference to Session Attribute    coderanch.com

37. refresh all browsers in a session when a session attribute changes    coderanch.com

I can't find a reference to a "JavaScript response that causes the parent to refresh" that is generated by the new window from the "open.window". I think it should be possible since it is basically what the javascript "prompt" function does by returning the text field value - I just need the dialog to be a list instead of a text ...

39. How could a session attribute go missing without using removeAttribute()    coderanch.com

Any ideas how a session attribute could go missing ? MyObject myOb = session.getAttribute("myAttribute"); ....... ....... if (myOb.myMethod()){ ..... //print out session.getAttributeNames() the second line of code above throws a null pointer, and when printing all the attributes in the session "myAttribute" does not exist. yet it has been definatly been set and no-where in the code is "removeAttribute()" used.

40. detect the session attributes after the session is TimeOut?    coderanch.com

Dear pros and newbs(like me) I have this session attribute containing an Object. I also have a session time out set to 30 minutes. In the servlet code I wrote the code below. malo.java.classes.UserAuthentication userAuthentication = (malo.java.classes.UserAuthentication) session.getAttribute("usersAuthentication"); //The full code is below, // this strip code is located in line 41.I also forward this object into a JSP page and ...

41. Getting Session Attribute Value    coderanch.com

42. set multiple session attribute    coderanch.com

43. setting attribute in session in filter    coderanch.com

I am trying to set a attribute into session from a filter. But the following code is not working. Please suggest..... public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { ServletContext sc=filterConfig.getServletContext(); DataSource ds=(DataSource)sc.getAttribute("Datasource_web"); HttpSession session=((HttpServletRequest) request).getSession(); String n_id=null; if(session.getAttribute("login")!=null){ try { if((n_id=(String)session.getAttribute("new_notice"))==null){ n_id=NextIDDAO.IDRetrive(ds, "noice"); NextIDDAO.updateNextID(ds, "notice"); session.setAttribute("new_notice", n_id); } chain.doFilter(request, response); } catch(Throwable t) { // If ...

44. Setting session attributes in java    forums.oracle.com

velocity123 wrote: I am setting a session attribute in a java file and fetching it a jsp. It works well with internet explorer, but does not work with mozilla firefox. The java code in your files executes long before a browser receives the pure html page that a .jsp page produces. Therefore, whether the java code works well or not does ...

45. session invalidate or removing attribute    forums.oracle.com

Removing what session attribute? Removing an attribute from a session is exactly that, you have removed a single aspect of the session from the session. The session itself is still valid. Session invalidate, invalidates that session so that it can no longer be used. Removing an attribute may have somewhat of the same effect if all of your servlets and jsp ...

46. Storing attributes in a session - what is too much?    forums.oracle.com

I have a database with approx. 1000 questions stored in it. Everytime a user wants to take a quiz, I randomly fill an ArrayList with 25 of these questions with their multiple choice options. Then I display these questions in a JSP. Once the user finishes the quiz, results are calculated and displayed to the user and also stored in the ...

47. JUnit and using a mock library to test a removed session attribute    forums.oracle.com

It means I create a session mock in my unit test. Then I call an external program passing in HttpServletRequest. The external program is a void method that removes the session attribute. My unit test still sees the session variable as set in the unit test. It does not see the session variable that was removed in the external program.

48. Prefer hidden field instead of session attribute    forums.oracle.com

In my application we have around 17 jsp for getting information from the user. Also we have around 65 jsp for user navigation This 17 jsp has average 19 html components like textbox, select etc To maintain user entered data we prefer hidden field than session attribute. Number of user: 1, 00,000 Server: WebSphere Application Server v6.1 Framework: struts 1 For ...

50. How pass to session attributes to another domain?    forums.oracle.com

Hello, my program is set up to pass values through session in another domain. It is a arrayList of a certain class that i created. The problem is if i setAttribute(PASS_VALUES, nameUtility) where nameUtility is may array of Class. (List nameUtility = new ArrayList()). When i get the attribute on the next domain. The PASS_VALUES in session is gone or do ...

51. session invalidate or removing attribute    forums.oracle.com

52. Session Attribute v/s Global Temporary Table    forums.oracle.com

Hi Gurus, Please tell me which aproach is better : I had a subquery which is complex enough, so to enhance the performance I thought of the following two approaches: 1) Store the information of the query in the Global Temporary Table and then fetch the values when ever required directly from the table. 2) Store the info in the session ...