Redirect into two different page after login.jsp according user category
I have created a login.开发者_开发知识库jsp
with some login username and password. Users are categorized into A and B. Then I have to redirect each user according to the user category. I also need to retrieve the username in the next page. My form in login.jsp
page is something like this:
<form method="POST" action='<%= response.encodeURL("j_security_check") %>'
Do I have to use javax.servlet.Filter
? what should be added in web.xml
?
Anyone had an idea how to do it?
Just use a if condition in servlet like this
// Get the user type
if (userType == Type1){
response.sendRedirect("Page1.jsp");
}else{
response.sendRedirect("Page2.jsp");
}
精彩评论