0 Replies - 1247 Views - Last Post: 17 February 2013 - 01:06 AM

#1 hwoarang69  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 171
  • Joined: 23-October 12

login page using jsp

Posted 17 February 2013 - 01:06 AM

how to create jsp login in page. how to make a loginpage? this is what i have.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!-- jsp directives code-->
<%@ page import="java.lang.Math.*"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
      <form method ="POST" action ="index1.jsp">
		Enter username:
		<input name="username" />
		Enter password:
		<input name="password" />
		<button type="submit">login</button>
	</form>

		

<%
	String username = request.getParameter("username");
	String password = request.getParameter("password");	
	
	if(username == null)
	{
		out.print("error_01");
	}
	else if (password == null)
	{
		out.print("error_02");
	}
       else
       {
          no errors... set session ...
       }
%>
</body>
</html>


*** Edit ***
Please use code tags when posting code
:code:

This post has been edited by GunnerInc: 17 February 2013 - 01:39 PM
Reason for edit:: Added elusive code tags


Is This A Good Question/Topic? 0
  • +

Page 1 of 1