• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SessionScoped bean created several times

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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! :-)
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Continued / copied from https://coderanch.com/t/672460/SessionScoped-bean-created-times.
 
reply
    Bookmark Topic Watch Topic
  • New Topic