This is not a DOA issue at all, I guess I didn't do a very good job of
explaining.
I simply want to access an UserID from anywhere in an web-app.
JSP, method of any class file, servlet or otherwise...etc.
( Passing a string is what I ended up with.)
Thanks all!
Jim
From: "Wendy Smoak" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
To: "Struts Users Mailing List" <user@struts.apache.org>
Subject: Re: Attributes, Parameter or Class
Date: Sun, 9 Jan 2005 13:14:55 -0700
From: "Jim Douglas" <[EMAIL PROTECTED]>
And then, from your Action, you would use the code Jack suggested, plus
change your method call:
Must it be from an Actioon? Does this mean that you can't use that code
above from a within a tiles contrloller, specifically the
session.getAttribute()?
No! That's the whole point-- your DAO class can be called from anywhere.
That's why it shouldn't know about a 'session' or a 'request'. Likewise it
shouldn't be tied to any other class "above" it. The DAO class only knows
its job and where to get the data. (As a layer it sits below the
application and above the database.) It doesn't care where the call is
coming from, it just receives a userId and returns whatever it's supposed
to return to whoever called it.
And the flip side is that your Action or Tiles Controller (or command line
or Swing app) doesn't know what kind of database you have, or even if there
IS a database. It just makes a DAO object, calls the method, and uses the
returned object however it intends to.
HTH,
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]