hi,
first of all i am sorry for the late reply. i didnt reply due to some health issue.
so here is my code for the problem as i mentioned earlier :
<form method="post" class="searchform" action="#">
<table class="pretty-table">
<tr><td>Username</td><td><input type="text" name="txtusername" class="textbox" /></td></tr>
<tr><td>Password</td><td><input type="password" name="txtpassword" class="textbox" /></td></tr>
<tr><td><input name="btnLogin" type="submit" value="Login" class="button"/></td><td><input name="btnCancel" type="reset" value="Cancel" class="button"/></td></tr>
<tr>
<td><a href="register.jsp">Back to registration page</a></td>
<td><a href="index.jsp">Back to home page</a></td>
</tr>
</table>
</form>
<%
String uname=request.getParameter("txtusername");
String password=request.getParameter("txtpassword");
PreparedStatement pst=conn.prepareStatement("Select user_type from user where user_name = ? and password = ? ");
pst.setString(1,uname);
pst.setString(2,password);
ResultSet rst=pst.executeQuery();
if(rst.next())
{
String type=rst.getString("user_type");
if("admin".equals(type))
{
response.sendRedirect("admin.jsp");
}
else if("seller".equals(type))
{
response.sendRedirect("seller.jsp");
}
else if("buyer".equals(type))
{
response.sendRedirect("buyer.jsp");
}
}
%>
this code is working fine with admin login only.
when i tried with other login(buyer or seller), it is not working. it stays on the same page.
please suggest me appropriate solution for this problem.