;
> > > public SQL92FormDetailDAO(Connection connection) {
> > > this.connection = connection;
> > > }
> > >
> > > public List listFormDetail() {
> > > List items = new ArrayList();
> > >
On Sun, 09 Jan 2005 17:05:04 -0500, Frank W. Zammetti wrote:
> The only thing that's like a global in Java is a static variable (static
> final usually, but in this case just static).
Another good trick in a web app is to use the ThreadLocal class to
simulate globals that are thread specific. AFAI
The only thing that's like a global in Java is a static variable (static
final usually, but in this case just static).
If you had a class like so:
public class userInfo {
private static String userID;
public static void setUserID(String userID) {
this.userID = userID;
}
public static
From: "Jim Douglas" <[EMAIL PROTECTED]>
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.)
It sounds like you want a global variable like you might have in a
procedural language. Th
k" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List"
To: "Struts Users Mailing List"
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 u
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!
ist"
To: "Struts Users Mailing List"
Subject: Re: Attributes, Parameter or Class
Date: Sun, 9 Jan 2005 09:20:26 -0700
From: "Jim Douglas" <[EMAIL PROTECTED]>
This line gives me a "cannot find symbol variable request"
String userID = request.getParameter(
From: "Jim Douglas" <[EMAIL PROTECTED]>
This line gives me a "cannot find symbol variable request"
String userID = request.getParameter("userID");
Re-read Frank's response-- your DAO class does not (and should not) know
anything about requests or sessions. You might also want to review the J2EE
From: Dakota Jack <[EMAIL PROTECTED]>
Reply-To: Dakota Jack <[EMAIL PROTECTED]>
To: Struts Users Mailing List
Subject: Re: Attributes, Parameter or Class
Date: Sat, 8 Jan 2005 21:18:53 -0800
String userID = request.getSession().getAttribute("userID");
or
HttpSession sessi
ere userID = " + userID;
>
>
> Thank for the great responses!
> -Jim
>
> >From: Larry Meadors <[EMAIL PROTECTED]>
> >Reply-To: Larry Meadors <[EMAIL PROTECTED]>
> >To: Struts Users Mailing List
> >Subject: Re: Attributes, Parameter or Cl
quot;select name, formdetail from "
+ "forms where userID = " + userID;
Thank for the great responses!
-Jim
From: Larry Meadors <[EMAIL PROTECTED]>
Reply-To: Larry Meadors <[EMAIL PROTECTED]>
To: Struts Users Mailing List
Subject: Re: Attri
s the best way from a design perspective.
(sorry about the multiple threads, I'll ony post follow up to the other one
from here)
Thanks,
-Jim
From: "Frank W. Zammetti" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: Struts Users Mailing List
Subject: Re: Attributes, Param
+ "forms where userID = " + userID;
Thank for the great responses!
-Jim
From: Larry Meadors <[EMAIL PROTECTED]>
Reply-To: Larry Meadors <[EMAIL PROTECTED]>
To: Struts Users Mailing List
Subject: Re: Attributes, Parameter or Class
Date: Sat, 8 Jan 2005 17:06:34 -07
Sorry Jim, I have to agree with the other posters...this is a really
unclear question.
I think what you are asking is this: When a user logs in, i want to
put the user id and password somewhere that i can always find it
easily.
If so, put it in session scope. It will be there until the session
ex
To access DB in Struts (and elsewhere) there is a Wiki page:
http://wiki.apache.org/struts/DaoRelated
So... anyone that wants to help people w/DAO can add to it.
.V
Jim Douglas wrote:
I have an LogonForm, LogonAction and when a user successfully logs on,
I set Attributes for "userID" and "userName
Maybe it's simple, like I thought it might be, maybe it's not. I gave
him the simple answer, you gave him a not-so-simple answer. Maybe we
helped, maybe we didn't, he'll have to come back with more details if not.
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
h
Maybe we can break this down quick and avoid a long thread.
> I have an LogonForm, LogonAction and when a user successfully logs on, I set
> Attributes for "userID" and "userName".
We don't know (A) where "userID" and "userName" come from or (B) why
you set them as attributes in the session. W
I was ready to reply about three hours ago, but I had a feeling my
answer was way too simplistic... Reading the question again, I'm not so
sure...
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
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 S
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
20 matches
Mail list logo