Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SessionScoped bean created several times

 
Jesus Schneider
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all.

I work with Eclipse Mars.2, the system has Java 1.8 update 102 for 64bits but this project uses Java 1.7, JSF Mojarra 2.2, Primefaces 6.0 and Tomcat 7.0.53/7.0.54/8.0.1/8.0.11. I have created the smallest test project in order to show the problem.

The test project consist of 2 pages created with templates, with a menubar on top to browse and a selectOneMenu also on top to select the current language. The current language is stored in a variable in a session bean which is used in both pages and is refreshed every time we change the selectOneMenu. When I run the APP on Tomcat 7.0.53 / Tomcat 8.0.1 or lesser versions it works percfectly, the SessionScoped bean is created just once and the value is kept correctly stored. The problem happens when I run the same APP in Tomcat 7.0.54 / Tomcat 8.0.11 or later versions, in such case the SessionScoped bean is created everytime it is used, and as the current language value is initialized it is always set to the default ( english ).

I have researched a lot and asked in several sites but without any luck. Maybe someone can iluminate me? Thanks a lot in advance!!

As I use templates a page is always composed of head_view.xhtml + index_view.xhtml / page2_view.xhtml + foot_view.xhtml (index_view.xhtml=page2_view.xhtml and the foot part is empty)

Following the test project files:


head_view.xhtml




index_view.xhtml




headBB.java





Language.java




sesion.java



Thanks a lot if you have read all the above! :-)
 
Rob Spoor
Sheriff
Posts: 20827
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Continued / copied from https://coderanch.com/t/672460/SessionScoped-bean-created-times.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!