Re: Utter Newbie Question

2003-11-12 Thread Arne Brutschy
Wednesday, November 12, 2003, 11:03:15 AM, you wrote:
JH> Why stop a storing a Boolean in the session to determine "logged-inness"?

JH> Why not just store the (validated) "User" object in the session and check for
JH> it's presence? That way, if it's there, one can utilize the data in the User
JH> object for whatever sordid little purpose said developer comes up with.

That excactly what I'm doing. At the login, the business logic checks
if the credentials supplied were right. If so, the user object will be
stored in the session. In that way, I can easily access all the user's
properties without doing a lookup all the time. You might run into
memory problems if you have a lot of simultanous logged in users
and/or big user objects. But that not the case for me. Additionally,
I'm storing a list of the users group membership in the session. So I
can do fast permission checks based on this list (always doing a
lookup for every groups is expensive).


JH> I mean using bean:write tags of the "User" object seems straightforward
JH> enough, but what about the List of "Children" objects that is part of
JH> the "User" object?

I don't really understand. I'm using code like this to access the
user object:


  <%-- check if the users object is stored in the session--%>
  
<%-- it's not, present a "you're not logged in" message --%>

  

  <%-- the user is logged in --%>
  
<%-- present a welcome message like "Welcome, John Doe." --%>
, ${sessionScope.user.name}.

<%-- display the logout form --%>

  
  <%-- the requested page parameter is used to return to this page 
after logout --%>
  
  

  


As you can see, I read and display the user's name with
${sessionScope.user.name}.

But I have to warn you, I'm a struts newbie too.. :)

Regards,
Arne Brutschy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Utter Newbie Question

2003-11-12 Thread Joe Hertz

I'm making using struts for more or less than first time.

I read the FAQ on how to handle logins to an application and I'm left with 
one question:

Why stop a storing a Boolean in the session to determine "logged-inness"? 

Why not just store the (validated) "User" object in the session and check for 
it's presence? That way, if it's there, one can utilize the data in the User 
object for whatever sordid little purpose said developer comes up with.

Is this a good idea?

If so, how do I go about doing this in the view? (I told you I was a newbie!).

I mean using bean:write tags of the "User" object seems straightforward 
enough, but what about the List of "Children" objects that is part of 
the "User" object?

TIA

-Joe

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]