This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, I have made an online shopping store using Servlets,JSP and EJBs. I want that when user presses 'Add to Cart' button for the first time, he is shown login page, where he has to login and every other time he is shown the shopping cart page. How do I find if the current user has logged in or not? Please tell me. I am using JBoss 3.2.1. Abhishek
How about setting a session attribute upon successful login and then on all the jsp's, use an if statement to see if that particular session attribute has been set. If it's null, forward them to the login screen. You have to watch for session timeouts.
You might need to specify one more thing though: are you using implicit J2EE security, or your application implements the security logic (explicit security). If you�re going with the second approach, then Tom already provided you the solution. Otherwise just let me know if you need further assistance. Regards.