As long as you only ever need these attributes in the context of a request (and that's the case for a JSP or a servlet), just store them in session. You'll have to pass them to whatever class you call from the JSP or servlet (or pass the session object itself, not what I'd suggest), but otherwise I think that's all your really looking for.
Alternatively, you could store it in an object as a static property, maybe as part of a HashMap for instance. Expose a thread-safe getter method and your all set. Of course, that implies that you have some identifiable ID to look up for each user, and I'd think userID would be it :)
That aside though, wouldn't just storing it in session do what you want?
-- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com
Dakota Jack wrote:
This looks like you are asking some JDBC questions about some specific database, Jim. Sorry to say this if you are not. If so, let me just get you going partly by saying that you probably want to use a PreparedStatement rather than a Statement. Start there? Have you read up on JDBC?
Jack
On Sat, 08 Jan 2005 19:25:15 +0000, Jim Douglas <[EMAIL PROTECTED]> wrote:
I have an LogonForm, LogonAction and when a user successfully logs on, I set Attributes for "userID" and "userName".
How would be the best way to make this information available to the Web App regardless of whether I need the data from within a JSP, servlet or class file(for example, building a dynamic query)
This is what I was trying to do and raised this issue(I can't get it to work)
public class SQL92FormDetailDAO implements FormDetailDAO {
private Connection connection; public SQL92FormDetailDAO(Connection connection) { this.connection = connection; }
public List listFormDetail() { List items = new ArrayList(); Statement statement =null; try { statement = connection.createStatement(); String userID = session.getAttribute("userID"); String query = "select name, formdetail from " + "forms where userID = " + userID;
Thanks, Jim
--------------------------------------------------------------------- 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]