Jsp Grid



Share on Google+Share on Google+

Jsp Grid
1 Answer(s)      6 years and 9 months ago
Posted in : JSP-Servlet
<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" %>
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <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;link rel="stylesheet" type="text/css" href="styles.css"&gt;

<p><title>jsp paging example in datagrid</title>
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 }

<p><span align="center" style="padding-left:250px;font-size:20px;"></span>
&lt;% ArrayList promptList = new ArrayList ();
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
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()) { 

catch (SQLException sqlException) {
System.out.println("Unable to connect to batabase."+sqlException);
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><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" >

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


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

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

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


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


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


<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"/>

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

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

</html> </p>
View Answers

February 3, 2011 at 5:49 PM

Hi Friend,

Please visit the following links:



Hope that the above links will be helpful for you.



Related Tutorials/Questions & Answers:
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
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  <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
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
Ajax grid
Ajax grid  Hi, How I can create ajax grid in my program? Thanks
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
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
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
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
Nitobi Grid V3
Nitobi Grid V3       Display & edit tabular data in various web browsers(IE, Firefox & Netscape) with Ajax-powered Nitobi Grid V3. With minimal coding, Grid delivers responsive
Version of com.nanosai>grid-ops dependency
List of Version of com.nanosai>grid-ops dependency
Version of com.nanosai>grid-ops dependency
List of Version of com.nanosai>grid-ops dependency
how to insert a summary values in grid
how to insert a summary values in grid  how to insert a summary value in grid
count asterisk in a grid - Java Beginners
count asterisk in a grid  I need to write a program that uses a recursive method to count the number of asterisk in a square grid
jsp  hai please give me the table grid code code for jsp
Grid in Echo3
Grid in Echo3       Grid is a two-dimensional structure on which the designers and developers can organize their components in a well and easy to understand manner. Grid class
Grid layout container
Grid layout container       Grid container places the child components in columns and rows. This is very similar to html tables. Inside the Grid tag, GridRow tag is used to represent
Version of com.hynnet>dhtmlx-grid-excel dependency
List of Version of com.hynnet>dhtmlx-grid-excel dependency
Version of com.hynnet>dhtmlx-grid-pdf dependency
List of Version of com.hynnet>dhtmlx-grid-pdf dependency
data grid with edit and delete options at each row.
data grid with edit and delete options at each row.  i want to display the table data in the format of data grid with edit and delete options at each row. i need it very urgently. advance thanks


Advertisement null