• 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

Which would be better - Session Attribute or Session Bean

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 EJB) which holds the get/set methods for eahc of the above and I call the methods accordingly or simply using session.setAttribute/session.getAttribute to store the values in the Browser sessiona nd retrieve them when eeded.

The lang value will be required for every page because when the user opens a page, the lang value (for example: en) will go away and get a en.properties file and populate tags on a page with text (en the page is in English, jp it's in japanese)

Cheers
KS
 
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would create a class to store all the info about the user and put the objects in session.
 
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a matter of style, but as Manuel suggested, the typical and expected solution would be to implement a class to do it.

If getter/setter methods are provided for all, then by definition it's a java bean.

if you're archiving it using hibernate or EJB, it would be annotated with @Entity in EJB 3, and you would deploy it to an application server
 
reply
    Bookmark Topic Watch Topic
  • New Topic