Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

help login.jsp  RSS feed

 
mehran mehran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my jsp file not work
please help me
-----------------------
<%@ page import="com.mehran.*,
java.sql.ResultSet"%>
<%
// Cookie.class.
Database db=new Database();
if(request.getParameter("sign")!=null)
{



String id = request.getParameter("user");
ResultSet rs=db.getTable("user","*"," where UserID= " + id);
if (rs.next())
{
String u1=(rs.getString("UserID"));
String u2=(request.getParameter("user"));
String p1=(rs.getString("Pass"));
String p2=(request.getParameter("pass"));
if((u1.equals(u2))&&(p1.equals(p2) ))
{

Cookie c = new Cookie("myCookie", "Hello My First Cookie");
response.addCookie(c);
session.setAttribute("pass",p2);
response.sendRedirect("insert.jsp");
}

else
{
%>
Your Login Is Incorrect <br>
Would You Like To <A HREF=login.jsp>Try Again</A>
<%
}
}
}
else
{

%>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<form method="POST" action="login.jsp">
<p align="center">
<b><font size="5">Sign In To Site :</font></b></p>
</p>
<p align="center"><font size="4">UserName : </font>
<font size="4" color="#FFFFFF"><input type="text" name="user" size="20"></font></p>
<p align="center" dir="ltr"><font size="4">PassWord : </font>
<font size="4" color="#FFFFFF"><input type="password" name="pass" size="20"></font></p>
<p align="center">                
<input type="submit" value="Sign In" name="sign"></p>
<p align="left">You Are Not a Member ?   <a href="signup1.jsp"> Sign
Up</a> Now!</p>
<p align="center">                 
</p>
</form>

</body>

</html>
<%
}
%>
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To help people help you, you should post what the problem is (i.e. exception w/ stack trace, or something doesn't show up, or whatnot) and put your code in between UBB Code tags.

From skimming your code, you might be getting an IllegalStateException from calling response.sendRedirect() after adding a cookie to the response, but I'm not sure about that.

-Yuriy
 
Jfriend lavanya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
let us know the problem first.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!