[pro25index.jsp]
<html>
<body>
<form method="get" action="pro25logincheck">
<table align=center cellpadding=10>
<tr>
<td colspan=2 align=center> <img src="logo.jpg"/>
<tr>
<td align="center" colspan=2><h2><i>LOGIN PAGE</i></h2>
<tr>
<td align=center><font color="red"><i>
<%
String msg=request.getParameter("msg");
if(msg==null)
out.println("");
else
out.println(msg);
%>
</i></font>
<tr>
<td>
<table align="center">
<tr>
<td>UserName
<td><input type="text" name="uname"><br/>
<tr>
<td>Password
<td><input type="password" name="pass"><br/>
<tr>
<td><input type="submit" value="LOGIN" >
<td><input type="reset" value="CLEAR">
</table>
<tr>
<td colspan=7 align="right"><i><a href="http://www.master-gtu.blogspot.com">master-gtu.blogspot.com</a></i>
</table>
</form>
</body>
</html>
[pro25logincheck.java]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/pro25logincheck")
public class pro25logincheck extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String uname=req.getParameter("uname");
String pass=req.getParameter("pass");
if(pass.equals(uname+"@123"))
{
HttpSession session=req.getSession(true);
session.setAttribute("uname",uname);
res.sendRedirect("pro25home");
}
else
res.sendRedirect("pro25index.jsp?msg=invaid username or password");
}
}
[pro25table.jsp]
<table border=5 align=center><tr><td><table border=0 cellpadding=20>
<tr>
<td colspan=7 align=center> <img src="logo.jpg"/>
<tr>
<td align=center bgcolor="limegreen"><a href='pro25home'>Home</a>
<td align=center bgcolor="limegreen"><a href='pro25inbox'>Inbox</a>
<td align=center bgcolor="limegreen"><a href='pro25sent'>Sent Mail</a>
<td align=center bgcolor="limegreen"><a href='pro25draft'>Draft</a>
<td align=center bgcolor="limegreen"><a href='pro25setting'>Setting</a>
<td align=center bgcolor="limegreen"><a href='pro25trash'>Trash</a>
<td align=center bgcolor="limegreen"><a href='pro25logout'>Logout</a>
<tr>
<td colspan=7><center><font color='green' size='15'>WELCOME <%=session.getAttribute("uname") %></font></center>
<tr>
<td colspan=7 align="right"><i><a href="http://www.master-gtu.blogspot.com">master-gtu.blogspot.com</a></i>
</table></table><br><br>
[pro25home.java]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/pro25home")
public class pro25home extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
HttpSession session=req.getSession(false);
if(session!=null)
{
RequestDispatcher dispatcher=req.getRequestDispatcher("/pro25table.jsp");
dispatcher.include(req,res);
out.println("<center><font face=\"Lucida Console\" size=\"15\" color=\"red\">This is a Home Page</font></center>");
}
else
res.sendRedirect("pro25index.jsp");
}
}
[pro25inbox.java]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/pro25inbox")
public class pro25inbox extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
HttpSession session=req.getSession(false);
if(session!=null)
{
RequestDispatcher dispatcher=req.getRequestDispatcher("/pro25table.jsp");
dispatcher.include(req,res);
out.println("<center><font face=\"Lucida Console\" size=\"15\" color=\"red\">This is a Index Page</font></center>");
}
else
res.sendRedirect("pro25index.jsp");
}
}
[pro25sent.java]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/pro25sent")
public class pro25sent extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
HttpSession session=req.getSession(false);
if(session!=null)
{
RequestDispatcher dispatcher=req.getRequestDispatcher("/pro25table.jsp");
dispatcher.include(req,res);
out.println("<center><font face=\"Lucida Console\" size=\"15\" color=\"red\">This is a Sent Page</font></center>");
}
else
res.sendRedirect("pro25index.jsp");
}
}
[pro25draft.java]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/pro25draft")
public class pro25draft extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
HttpSession session=req.getSession(false);
if(session!=null)
{
RequestDispatcher dispatcher=req.getRequestDispatcher("/pro25table.jsp");
dispatcher.include(req,res);
out.println("<center><font face=\"Lucida Console\" size=\"15\" color=\"red\">This is a Draft Page</font></center>");
}
else
res.sendRedirect("pro25index.jsp");
}
}
[pro25trash.java]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/pro25trash")
public class pro25trash extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
HttpSession session=req.getSession(false);
if(session!=null)
{
RequestDispatcher dispatcher=req.getRequestDispatcher("/pro25table.jsp");
dispatcher.include(req,res);
out.println("<center><font face=\"Lucida Console\" size=\"15\" color=\"red\">This is a Trash Page</font></center>");
}
else
res.sendRedirect("pro25index.jsp");
}
}
[pro25setting.java]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/pro25setting")
public class pro25setting extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
HttpSession session=req.getSession(false);
if(session!=null)
{
RequestDispatcher dispatcher=req.getRequestDispatcher("/pro25table.jsp");
dispatcher.include(req,res);
out.println("<center><font face=\"Lucida Console\" size=\"15\" color=\"red\">This is a Setting Page</font></center>");
}
else
res.sendRedirect("pro25index.jsp");
}
}
[pro25logout.java]
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
@WebServlet("/pro25logout")
public class pro25logout extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
HttpSession session=req.getSession(true);
session.invalidate();
res.sendRedirect("pro25index.jsp?msg=Logout Successfully....");
}
}
No comments:
Post a Comment