Putting controller logic in a regular Java class.
Architecting and Designing Scalable, Multitier Systems
by Michael Minh Nguyen
Listing 3. Putting controller logic in a regular Java class.
public class UserController
// 1. Implement controller logic to create beans such as session
// bean, EJBs, and regular beans as needed to register the user.
// 2. return User bean if successful. Return null if failed.
public User registerUser (String firstName, String middleInitial,
String lastName, String email)
User user = null;
user = new User ();
// Provide system-specific logic here to save User such as
// creating a session bean
// that save User to the database.
catch (Exception exception)
// perform error processing here
Michael Minh Nguyen is a senior software engineer at eBuilt Inc. in Irvine, CA. He may be contacted at [email protected].