Category Archives: Java

Paging in JSP without DisplayTag Library.

Standard

<%–
Document : index
Created on : Mar 28, 2013, 2:07:24 PM
Author : MOZIB
–%>

<%@page contentType=”text/html” pageEncoding=”UTF-8″%>
<%@taglib prefix=”c” uri= “http://java.sun.com/jsp/jstl/core”%&gt;
<%@taglib prefix=”sql” uri= “http://java.sun.com/jsp/jstl/sql&#8221; %>
<sql:setDataSource driver=”com.mysql.jdbc.Driver”></sql:setDataSource>
<sql:setDataSource driver=”com.mysql.jdbc.Driver” url=”jdbc:mysql://localhost:3306/testdata” user=”root” password=”password”></sql:setDataSource>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>Dynamic page</title>
</head>

<body>

<table border=”1″ align=”center”>
<br>
<form>
<%– <h5>Select the limit to display the pages</h5>
<select name=”se” onchange=”form.submit()”>

<option value=”select” >
select
</option>
<option value=”5″ > 5 </option><option value=”10″ >10</option>

<option value=”15″ >
15
</option>
<option value=”${20}” >
20
</option>

</select>

</form>
<c:set var=”limit” value=”${param.se}”></c:set> –%>
<h1><center><font color=”green”>Order Booking Transanction </font></center></h1>

<sql:query var=”max1″ sql=”select count(*) as m from orderbooking_trans”></sql:query>

<c:forEach var=”r” items=”${max1.rows}”>
<c:set var=”temp” value=”${r.m}”></c:set>

</c:forEach>

<c:set var=”z” value=”${param.id}”></c:set>
<c:set var=”t” value=”${0+z}”></c:set>
<c:set var=”s” value=”${t+10}”></c:set>
<c:set var=”f” value=”${t-10}”></c:set>
<c:if test=”${s gt t}”>
<sql:query var=”d” sql=”select * from orderbooking_trans limit ${t},10″></sql:query>
<c:forEach var=”x” items=”${d.rows}”>
<tr><td>${x.Order_Id}</td><td>${x.Prospect_Id}</td><td>${x.Emp_Id}</td>
<td>${x.Order_date}</td><td>${x.Subvention}</td><td>${x. Margin}</td>
<td>${x.Spl_Offers}</td><td>${x.Dsa_Payout}</td><td>${x.FleetAmt}</td><td>${x.TotalOutFlow}</td>
<td>${x.TotalInFlow}</td><td>${x.TotalCosttoDlrship}</td><td>${x.CustType}</td>
<td>${x.ModeOfPurchase}</td><td>${x.FSource_Id}</td>
<td>${x.Paper_Fleet}</td></tr>
<c:if var=”max” test=”${x eq null}”>
</c:if>
</c:forEach>
</c:if>
<c:if test=”${t gt s}”>
<c:set var=”q” value=”${t-z}”></c:set>
<sql:query var=”d” sql=”select * from orderbooking_trans ${q},10″></sql:query>
<c:forEach var=”x” items=”${d.rows}”>
<tr><td>${x.Order_Id}</td><td>${x.Prospect_Id}</td><td>${x.Emp_Id}</td>
<td>${x.Order_date}</td><td>${x.Subvention}</td><td>${x. Margin}</td>
<td>${x.Spl_Offers}</td><td>${x.Dsa_Payout}</td><td>${x.FleetAmt}</td><td>${x.TotalOutFlow}</td>
<td>${x.TotalInFlow}</td><td>${x.TotalCosttoDlrship}</td><td>${x.CustType}</td>
<td>${x.ModeOfPurchase}</td><td>${x.FSource_Id}</td>
<td>${x.Paper_Fleet}</td></tr>
</c:forEach>
</c:if>
<c:if test=”${max ne false}”>
<td border=”0″><h2><font color=”red”>No Records </font></h2></td>
</c:if>

</table>

<table border=”0″ align=”center”>
<tr>

<c:set var=”c” value=”${s}”></c:set>
<c:set var=”p” value=”${f}”></c:set>
<c:if test=”${p gt 0 or p eq 0}”>
<td>&nbsp;<a href=”index.jsp?id=${p}”><<<<</a></td>
</c:if>

<c:forEach var=”v” begin=”0″ end=”${temp}” step=”10″>

<c:set var=”i” value=”${i+1}”></c:set>

<c:if test=”${v ne temp or v eq temp}”>
<c:if test=”${max eq false}”>
<td>&nbsp;<a href=”index.jsp?id=${v}”>${i}</a></td>
</c:if>
</c:if>
</c:forEach>

<c:if test=”${max eq false}”>

<td>&nbsp;<a href=”index.jsp?id=${c}”>>>>></a></td>
</c:if>

</tr>
</table>
<p>&nbsp;</p>

</center>

 

</body>
</html>

Advertisements

NS2 (NS-2.35) Installation in Ubuntu

Standard

This post will help you in installing Network Simulator 2 version NS2.35 in Ubuntu 11.10
Instructions
• Install Ubuntu

  • Unzip or untar it to any folder (recommended is /home/loginname) using the following commands one by one
  • sudo apt-get update
  • sudo apt-get build-essential autoconf automake libxmu-dev
  • tar zxvf ns-allinone-2.35.tar.gz (simply you may extract manually )
  • cd ns-allinone-2.35
  • ./install
  • after that go through ubuntu’s software center and search “NS2 ” you will get “Discrete event simulator targeted at networking research ns2”  and once again install it.