For storing user info, using sessions is the best way. Think about not using sessions: you should someway propagate an "ID" of the user between requests. Luckily, J2EE applications store a session ID as a cookie or (if cookies are not enabled) propagates it in URLs. But be cautious using session, don't abuse it. If you want to use it only to store user information, it is correct. But if you want to store, for example, data between request to realize a wizard, it is wrong. In this case, you should propagate temporary acquired values between requests, because you could reach inconsistence. For example, think about opening two different windows with the same "wizard". The session ID is the same, then data could cross themselves, making a real mess! But this is not your case, so use session. Ciao Antonio Petrelli
Brian McGovern wrote: >Hi, > >I'm planning my approach to a data driven app that I have to write in the near future. I've used struts before in more of a demo-type, proof of concept scenarios, and am no where near and expert, but now need to build a production level system. > >For a web app that needed to display a username on every screen I was previously doing it like this: > > HttpSession zCurrentSession = request.getSession(false); > if (zCurrentSession == null){ > zCurrentSession = request.getSession(true); > } > try { > zUserInfoBn = zUserData.getUserInfo(sEmailAddress); > zUserInfoBn.setIsLoggedIn(true); > }catch (ApplicationException zAppEx){ > throw zAppEx; //stubbed out not complete > } > zCurrentSession.setAttribute(sUSERINFO_BN, zUserInfoBn); > >So I'm hoping I can get some opinions on how to display things like user information on the screens in an intelligent way. I'm not sure where the trade offs are between hitting the DB every time and storing at the request level, using cookies, or storing it some other way. > >Any ideas would be helpful. I'm in the rare position of being able to take my time and think out the approach and would love input from people who've got more experience than me. > >My env is linux, tomcat 5.0.28, latest jdk, struts, separate box running db (sql server 2000 w/ stored procs) on a 2.8ghz xeon box with 1 gig mem. To start the app shouldnt get more than 50,000 page views a month. > >Thanks >-Brian > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]