开发者

Redirect into two different page after login.jsp according user category

开发者 https://www.devze.com 2022-12-30 12:53 出处:网络
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

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");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消