File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes newbie question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "newbie question" Watch "newbie question" New topic

newbie question

majid nakit
Ranch Hand

Joined: Jun 26, 2001
Posts: 167
I have two tables :
users (id, firsname, lastnime, username, password, rolekey)

roles (id, rolename)

In my LoginAction I need a call to a method getInfo(username, password) of another class Services to get the username and the rolename, my question is how I am going to save username and rolename in getInfo(...) and how I will pass get them back in LoginAction ??

Thank you.
Pratik Lohia
Ranch Hand

Joined: May 05, 2005
Posts: 88
From what I understand....
You want getInfo method to return the userName and password.

If your userName and password are object variables(which I assume they must be of type String...) then remember, in Java, objects are passed by reference. So whenever you call a method by passsing these objects as parameters, the values assigned to them in the called method, remain till the scope of existence of that object variable(which in your case would be the calling method, if the variables have been instantiated there..).
so even if ure method getInfo returns a void... your userName and password will have the values assigned to them in the getInfo method.
I agree. Here's the link:
subject: newbie question
It's not a secret anymore!