postheadericon 26.Develop an application to write a "page-composite" JSP that includes other pages or passes control to another page. (Hint: Use <jsp:include> or <jsp:forward>).


index.jsp


<html>
<head>
<title>EX-26</title>
<style>
div
{
background:#ababff;
position:absolute;
width:1000px;
left:110px;

}

.abcH
{
top:0.5cm;
width:1000px;
border-style:solid;
}

.abcL
{
top:200px;

width:1000px;
}

.abcF
{
top:500px;
width:1000px;
border-style:solid;
}
</style>
</head>

<body bgcolor="#ababff">
<%@ include file="/header.jsp" %>
<jsp:include page="/login.jsp" />
<jsp:include page="/footer.jsp" />
<br>
</div>
</body>
</html>


header.jsp


<div class="abcH"  id="f1">
<br>
<table align="center">
<tr>
<td><h1>www.BipinRupadiya.blogspot.in<h1></td>
</tr>
</table>

</div>



login.jsp



<div class="abcL"  id="f1">
<br>
<form method="POST" action="result.jsp">
<table align="center">
<tr>
<td colspan=2 align=center> <h3>Login</h3><hr></td>
</tr>
<tr>
<td>User Name : </td>
<td><input type="text" name="txtUsr"></td>
</tr>
<tr>
<td>Password :</td>
<td><input type="password" name="txtPwd"></td>
</tr>
<tr>
<td colspan=2 align=center><hr>
<input type="submit" value="Login">
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
</div>


footer.jsp


<div class="abcF"  id="f2">
<br>
<table align="center">
<tr>
<td><h3>&copy; Mr. Bipin S Rupadiya<h3></td>
</tr>
</table>
</div>


result.jsp


<%
String d;
if(request.getParameter("txtUsr").equals("bipin") &&
request.getParameter("txtPwd").equals("rupadiya"))
d="welcome.jsp";
else
d="index.jsp";
%>
<jsp:forward page="<%= d%>" />


welcome.jsp


<html>
<head>
<title>EX-26</title>
<style>
div
{
background:#ababff;
position:absolute;
width:1000px;
left:110px;

}

.abcH
{
top:0.5cm;
width:1000px;
border-style:solid;
}

.abcL
{
top:200px;

width:1000px;
}

.abcF
{
top:500px;
width:1000px;
border-style:solid;
}
</style>
</head>

<body bgcolor="#ababff">
<%@ include file="/header.jsp" %>
<div class="abcL">
<center><h1>Welcome</h1><br>
<br>
<a href="index.jsp">Home</a>
</div>
<jsp:include page="/footer.jsp" />
<br>
</div>
</body>
</html>



0 comments:

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.