Jsp Grid

Jsp Grid

<p>&lt;%@ page language="java" import="java.util.<em>,saar.etisalat.dto.</em>,saar.etisalat.*" pageEncoding="ISO-8859-1"%>
&lt;%@ page contentType="text/html"%>
&lt;%@ page import="org.apache.taglibs.datagrid.DataGridParameters"%> 
&lt;%@ page import="java.sql.*"%>
&lt;%@ taglib uri="http://jakarta.apache.org/taglibs/datagrid-1.0" prefix="ui" %>
&lt;%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
&lt;%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
&lt;%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="&lt;%=basePath%>"></p>

<pre class="prettyprint">&lt;title&gt;My JSP 'page.jsp' starting page&lt;/title&gt;

&lt;meta http-equiv="pragma" content="no-cache"&gt;
&lt;meta http-equiv="cache-control" content="no-cache"&gt;
&lt;meta http-equiv="expires" content="0"&gt;    
&lt;meta http-equiv="keywords" content="keyword1,keyword2,keyword3"&gt;
&lt;meta http-equiv="description" content="This is my page"&gt;
&lt;!--
&lt;link rel="stylesheet" type="text/css" href="styles.css"&gt;
--&gt;
</code></pre>

<p><title>jsp paging example in datagrid</title>
<style>
th a:link { text-decoration: none; color: black }
th a:visited { text-decoration: none; color: black }
.rows { background-color: white }
.hiliterows { background-color: pink; color: #000000; font-weight: bold }
.alternaterows { background-color: #efefef }
.header { background-color: cyan; color: #000000;font-weight: bold }</p>

<p>.datagrid { border: 1px solid #C7C5B2; font-family: arial; font-size: 9pt;
font-weight: normal }
</style>
</head>
<body>
<br><br></p>

<p><span align="center" style="padding-left:250px;font-size:20px;"></span>
<br>
&lt;% ArrayList promptList = new ArrayList ();
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
connection=Conn.openConnection();
Announcements announce = new Announcements ();
int fromIndex, toIndex;
int tcount =0;
int perpage=4;
int tpage=0;
try {</p>

<p>preparedStatement = connection.prepareStatement("SELECT * from global_announcements");
resultSet= preparedStatement.executeQuery();
while (resultSet.next()) { 
tcount++;</p>

<p>announce.setPromptId(resultSet.getString("prompt_id"));
announce.setPromptDescription(resultSet.getString("prompt_description"));
announce.setStartDate(resultSet.getString("start_date"));
announce.setEndDate(resultSet.getString("end_date"));
announce.setStatus(resultSet.getString("status"));
promptList.add(announce);
}
} 
catch (SQLException sqlException) {
System.out.println("Unable to connect to batabase."+sqlException);
}finally{
   Conn.closeConnection(resultSet,preparedStatement,connection);
}
fromIndex = (int) DataGridParameters.getDataGridPageIndex (request, "datagrid1");
if ((toIndex = fromIndex+4) >= promptList.size ())
toIndex = promptList.size();
request.setAttribute ("promptList", promptList.subList(fromIndex, toIndex));</p>

<p>pageContext.setAttribute("tCount", tcount);
%></p>

<p><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
&lt;%String promptlist=(String)request.getAttribute("promptList"); %>
<ui:dataGrid items="&lt;%=promptlist%>" var="prompt" name="datagrid1" cellPadding="0" 
cellSpacing="0" styleClass="datagrid" >
<columns></p>

<p><column width="50">
<header value="" hAlign="left" styleClass="header"/></p>

<p></column></p>

<p><column width="200">
<header value="PromptId" hAlign="left" styleClass="header"/>
<item value="&lt;%=announce.getPromptId()%>" hAlign="left" 
styleClass="item"/></p>

<p></column>
<column width="200">
<header value="PromptDescription" hAlign="left" styleClass="header"/>
<item value="&lt;%=announce.getPromptDescription()%>" hAlign="left" styleClass="item"/></p>

<p></column>
<column width="200">
<header value="StartDate" hAlign="left" styleClass="header"/>
<item value="&lt;%=announce.getStartDate()%>" hAlign="left" styleClass="item"/></p>

<p></column></p>

<p><column width="100">
<header value="EndDate" hAlign="left" styleClass="header"/>
<item value="&lt;%=announce.getEndDate()%>" hAlign="left" styleClass="item"/></p>

<p></column></p>

<p><column width="100">
<header value="Status" hAlign="left" styleClass="header"/>
<item value="&lt;%=announce.getStatus()%>" hAlign="left" styleClass="item"/></p>

<p></column></p>

<p></columns>
<rows styleClass="rows" hiliteStyleClass="hiliterows"/>
<alternateRows styleClass="alternaterows"/></p>

<p><paging size="4" count="request.getAttribute{tCount}" custom="true" nextUrlVar="next" 
previousUrlVar="previous" pagesVar="pages"/>
<order imgAsc="up.gif" imgDesc="down.gif"/>
</ui:dataGrid></p>

<table width="750" style="font-family: arial; font-size: 10pt" border=0>

<tr>
<td align="left" width="33%">
<c:if test="${previous != null}">
<a href="<c:out value="${previous}"/>">Previous</a>
</c:if>&nbsp;
</td>
<td align="center" width="33%">
<c:forEach items="${pages}" var="page">
<c:choose>
<c:when test="${page.current}">
<b><a href="<c:out value="${page.url}"/>"><c:out value="${page.index}"/></a></b>
</c:when>
<c:otherwise>
<a href="<c:out value="${page.url}"/>"><c:out value="${page.index}"/></a>
</c:otherwise>
</c:choose>
</c:forEach>
</td>
<td align="right" width="33%">&nbsp;
<c:if test="${next != null}">
<a href="<c:out value="${next}"/>">Next</a>
</c:if>
</td>
</tr>
</table>

<p></body>
</html> </p>
View Answers

February 3, 2011 at 5:49 PM

Hi Friend,

Please visit the following links:

http://www.roseindia.net/jsp/data-grid.shtml

http://www.roseindia.net/jsp/paging.shtml

Hope that the above links will be helpful for you.

Thanks









Related Tutorials/Questions & Answers:
GRID IN JSP - JSP-Servlet
GRID IN JSP  I m creating one ERP project in which i need to fill the data from the data base in a grid in jsp page. So pls any one provide the code
jsp grid
jsp grid  In jsp table example the values are not being accepted the error is that the item tag doesn't accept any attributes
Advertisements
Jsp Grid
Jsp Grid  <p>&lt;%@ page language="java" import="java.util....;"></p> <pre class="prettyprint">&lt;title&gt;My JSP...; --&gt; </code></pre> <p><title>jsp paging example
data grid - JSP-Servlet
data grid  how can we implement data grid (we have data grid in asp.net) in jsp. can u please send me the sample code and also the possible ways to implement data grid in jsp Thanks varun kumar  Hi friend, I
editable grid in jsp
editable grid in jsp  i want to create editable grid in jsp for invoice so that i can insert multiple product at a same time.how to create that in jsap, plz reply   We are providing you the code where we have specified
data grid - JSP-Servlet
data grid  i am trying to do the example in the following link http://www.roseindia.net/jsp/data-grid.shtml but i am not able to find... this example  Hi friend, To visit again http://www.roseindia.net/jsp/data
how to display data in List Or grid or in table in Jsp
how to display data in List Or grid or in table in Jsp   <%@page...;JSP Reading Text File</title> </head> <body> <...(); } %> </body> </html> this is my jsp code i want to display
Create Data Grid in JSP page
Create Data Grid in JSP page   ... grid that shows data from database table in jsp page. In this jsp code given... this data grid will fetch data and show in a jsp page. We have used database name
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?
How to make a horizontally Scrollable grid in jsp using div, table, css, javascript?  In a jsp page InsertUpdate.jsp (say) there is a button Insert... saving data would be viewed in grid in the same page. Now problem is that, I need
jsp
jsp  hai please give me the table grid code code for jsp
Sigma grid -- Ajax-enabled JavaScript grid
Sigma grid -- Ajax-enabled JavaScript grid       Sigma Grid Sigma Grid is a freely open source AJAX editable data grid, written in pure javascript for displaying and inline
Java with Grid - Ajax
/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx grid.... thanks.  Hi Friend, You can use jsp / servlet. For code, please visit the following links: http://www.roseindia.net/jsp/data-grid.shtml http
Ajax grid
Ajax grid  Hi, How I can create ajax grid in my program? Thanks
HTML GRID
HTML GRID  how to retrieve data from mysql database in grid form using html and servlets? urgent....   import java.io.*; import java.sql....); } out.println("<html><h3>Pagination of JSP page</h3><body><
Nitobi Grid is not working in IE10/IE11
Nitobi Grid is not working in IE10/IE11  Nitobi grid is working in IE8, but not working in IE10/IE11. we are using above two javascript files to open the grid
ModuleNotFoundError: No module named 'grid'
ModuleNotFoundError: No module named 'grid'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'grid' How to remove the ModuleNotFoundError: No module named 'grid' error
java + grid - Java3D
java + grid  i need to give the output of the application in the form of a grid in XY-plane,the grid should have different colors for regions of different value range
How to export grid into excel
How to export grid into excel  Hi, i created a grid panel i have to export it to the excel. please help me by some sample code. thanks in advance. cool day dude
Grid Problem - Java Beginners
Grid Problem  Hi Deepak Plz take seriously I m telling u detail. Steps: 1:- there r one form,this form belong to grid. and two... belong to different table.but in main form,all data going in the grid(with join
add row in grid using dojo
add row in grid using dojo  add row in grid using dojo
give me a grid example in php
give me a grid example in php  give me easy code example of grid in php like mysql editor
JSP Editor - JSP-Servlet
JSP Editor  Hi! I am using IDE Netbeans 5.5. One of my friend told me if you install plugins you can work with JSP with simple drag and drops and grid views such as grid view and multi view how we are doing in .NET
Version of com.nanosai>grid-ops dependency
List of Version of com.nanosai>grid-ops dependency
Grid rows delete issue
Grid rows delete issue  I have a grid having rows with Remove button to remove rows,But we also havae an facility to remove those rows on onchange event of dropdown also,so if we delete middle row and then remove all rows
ModuleNotFoundError: No module named 'djangocms-grid'
ModuleNotFoundError: No module named 'djangocms-grid'  Hi, My... named 'djangocms-grid' How to remove the ModuleNotFoundError: No module named 'djangocms-grid' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ez-grid'
ModuleNotFoundError: No module named 'ez-grid'  Hi, My Python...-grid' How to remove the ModuleNotFoundError: No module named 'ez-grid... to install padas library. You can install ez-grid python with following command
ModuleNotFoundError: No module named 'grid-instrument'
ModuleNotFoundError: No module named 'grid-instrument'  Hi, My... named 'grid-instrument' How to remove the ModuleNotFoundError: No module named 'grid-instrument' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'grid-instrument'
ModuleNotFoundError: No module named 'grid-instrument'  Hi, My... named 'grid-instrument' How to remove the ModuleNotFoundError: No module named 'grid-instrument' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'GRID-LRT'
ModuleNotFoundError: No module named 'GRID-LRT'  Hi, My Python... 'GRID-LRT' How to remove the ModuleNotFoundError: No module named 'GRID-LRT... to install padas library. You can install GRID-LRT python with following
ModuleNotFoundError: No module named 'grid-toolkit'
ModuleNotFoundError: No module named 'grid-toolkit'  Hi, My Python... 'grid-toolkit' How to remove the ModuleNotFoundError: No module named 'grid-toolkit' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'kotti_grid'
ModuleNotFoundError: No module named 'kotti_grid'  Hi, My Python... 'kotti_grid' How to remove the ModuleNotFoundError: No module named 'kotti_grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'LyaRT-Grid'
ModuleNotFoundError: No module named 'LyaRT-Grid'  Hi, My Python... 'LyaRT-Grid' How to remove the ModuleNotFoundError: No module named 'LyaRT-Grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'photo-grid'
ModuleNotFoundError: No module named 'photo-grid'  Hi, My Python... 'photo-grid' How to remove the ModuleNotFoundError: No module named 'photo-grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'polar_grid'
ModuleNotFoundError: No module named 'polar_grid'  Hi, My Python... 'polar_grid' How to remove the ModuleNotFoundError: No module named 'polar_grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'polar_grid'
ModuleNotFoundError: No module named 'polar_grid'  Hi, My Python... 'polar_grid' How to remove the ModuleNotFoundError: No module named 'polar_grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'python-grid'
ModuleNotFoundError: No module named 'python-grid'  Hi, My Python... 'python-grid' How to remove the ModuleNotFoundError: No module named 'python-grid' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'python-grid'
ModuleNotFoundError: No module named 'python-grid'  Hi, My Python... 'python-grid' How to remove the ModuleNotFoundError: No module named 'python-grid' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'sdh.cross-grid'
ModuleNotFoundError: No module named 'sdh.cross-grid'  Hi, My... named 'sdh.cross-grid' How to remove the ModuleNotFoundError: No module named 'sdh.cross-grid' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'smecv-grid'
ModuleNotFoundError: No module named 'smecv-grid'  Hi, My Python... 'smecv-grid' How to remove the ModuleNotFoundError: No module named 'smecv-grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'solentware-grid'
ModuleNotFoundError: No module named 'solentware-grid'  Hi, My... named 'solentware-grid' How to remove the ModuleNotFoundError: No module named 'solentware-grid' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'tensor-grid'
ModuleNotFoundError: No module named 'tensor-grid'  Hi, My Python... 'tensor-grid' How to remove the ModuleNotFoundError: No module named 'tensor-grid' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'tensor-grid'
ModuleNotFoundError: No module named 'tensor-grid'  Hi, My Python... 'tensor-grid' How to remove the ModuleNotFoundError: No module named 'tensor-grid' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'words-grid'
ModuleNotFoundError: No module named 'words-grid'  Hi, My Python... 'words-grid' How to remove the ModuleNotFoundError: No module named 'words-grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'alert-grid'
ModuleNotFoundError: No module named 'alert-grid'  Hi, My Python... 'alert-grid' How to remove the ModuleNotFoundError: No module named 'alert-grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'djangocms-grid'
ModuleNotFoundError: No module named 'djangocms-grid'  Hi, My... named 'djangocms-grid' How to remove the ModuleNotFoundError: No module named 'djangocms-grid' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ease_grid'
ModuleNotFoundError: No module named 'ease_grid'  Hi, My Python... 'ease_grid' How to remove the ModuleNotFoundError: No module named 'ease_grid' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'Easy-GRID'
ModuleNotFoundError: No module named 'Easy-GRID'  Hi, My Python... 'Easy-GRID' How to remove the ModuleNotFoundError: No module named 'Easy-GRID' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'ez-grid'
ModuleNotFoundError: No module named 'ez-grid'  Hi, My Python...-grid' How to remove the ModuleNotFoundError: No module named 'ez-grid... to install padas library. You can install ez-grid python with following command
ModuleNotFoundError: No module named 'feincms-grid'
ModuleNotFoundError: No module named 'feincms-grid'  Hi, My Python... 'feincms-grid' How to remove the ModuleNotFoundError: No module named 'feincms-grid' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'grid-control'
ModuleNotFoundError: No module named 'grid-control'  Hi, My Python... 'grid-control' How to remove the ModuleNotFoundError: No module named 'grid-control' error? Thanks   Hi, In your python

Ads