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 ??
posted 9 years ago
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.