I want to do this, When the user input is processed, it will be checked against the database to see what�s the role associated with the user. If the user is in the �admin� role, it will show �Hello Admin� on the second page. Using struts and mysql, I've got the jsp,Formbean ,but the mysql logic is problem .What's the solution on the sql side to check the user?
part code ______________________________________________________________________________
I'd suggest creating a JavaBean named "User" containing a userId and a role property. When the user logs on, query the database for that user ID. If the password matches, retrieve the role and place it in the User bean. Then place the User bean in the HTTPSession object using the setAttribute Method. In the welcome JSP, you can then get the user role with the following statement: