Posts filed under 'servers'

A simple displaytag grid demo

Display tags are pretty good option when it comes to creating a enterprise class data grid.
The sample code given below is quite a head start for building up a bulky grid.

// Create class that returns a list
package org.ixfree.Displayags;
import java.util.*;
public class GridList {

private List aList;

public List getAList() {
return aList;
}
public void setAList(List list) {
aList = list;
}
public GridList(int i)
{
this.aList = new LinkedList<DataBean>();
}
}

// POJO bean that goes into the list. DataBean in our case.
package org.ixfree.Displayags;
public class DataBean {

private String name;
private String age;

public String getName()
{
return this.name;
}

public String getAge()
{
return this.age;
}

public String setName(String name)
{
this.name = name;
}

public String setAge(String age)
{
this.age = age;
}
}

// Get the libraries reffered
// Sql needed if you wanna get the data out of the table. Ofcourse there are much better ways to do it.
<%@ taglib uri=”http://displaytag.sf.net” prefix=”display”%>
<%@ page import=”java.util.*” %>
<%@ page import=”org.ixfree.Displayags.*” %>
<%@ page import=”java.sql.*” %>

<%
// Make a list of data for populating grid
List<DataBean> list = new GridList(6).getAList();

// .. Get the data into the bean and add it to the list.
// .. Every bean here refers to a row in the grid. Yeppiiie….

// Put the list in the request
request.setAttribute( “storedList”,list);
%>

// Make it as a XHTML (good for the browser)
<head>
<!– All script and style/references goes here –>

<link href=”ixfreeDemoDisplayTags.css” rel=”stylesheet” type=”text/css”>
</head>
<body>
<!– If you dont want the grid to introduce scroll bar for the window, but ok for the grid –>
<div id=”My_DisplayTag_Grid” style=”width: 800px; height: 360px; overflow: auto” >
<!–
The pageSize is pretty useful when you wanna have pagination
class is just our regular css stuff
headerClass applies to the TH’s

name attribute of the display:table tag does the magic of reading our list.

–>
<display:table name=”storedList” class=”myDisplayTagStyle” id=”displayTable” pagesize=”10″ requestURI=”theCurrentJspPage.jsp”>
<display:column  sortable=”true” property=”name” title=”Name”  class=”myDisplayTagStyle” headerClass=”myDisplayTagStyle”/>
<display:column  sortable=”true” property=”age” title=”Age” class=”myDisplayTagStyle” headerClass=”myDisplayTagStyle” />
</display:table>
</div>
</body>

### ixfreeDemoDisplayTags.css goes this way ###
html
{
scrollbar-base-color: #dddddd;

}

table.myDisplayTagStyle
{
background-color: #dddddd;
}

td.myDisplayTagStyle
{
border-color: black;
border-width: 1px 1px 1px 1px;
border-style: solid;
margin: 0;
font-family:Arial Verdana;
font-size:10pt;
overflow: auto;
white-space:nowrap;
padding-top: 6px;
padding-right: 6px;
padding-left: 6px;
padding-bottom: 6px;
}

tr.odd
{
border-color: black;
border-width: 1px 1px 1px 1px;
border-style: solid;
margin: 0;
padding: 4px;
background-color: #ffffff;
white-space:nowrap;
}

tr.even
{
border-color: black;
border-width: 1px 1px 1px 1px;
border-style: solid;
margin: 0;
padding: 4px;
background-color: #dddddd;
white-space:nowrap;
}

th.myDisplayTagStyle
{
background-color: #dddddd;
border-color: black;
border-width: 1px 1px 1px 1px;
border-style: solid;
font-size: 9pt;
white-space: nowrap;
padding-top: 10px;
padding-right: 10px;
padding-left: 10px;
padding-bottom: 10px;
}

Add comment December 11, 2008

Rendering Jasper Reports as HTML

Attached below is a sample file on rendering Jasper Reports as HTML. This post is a follow up of my earlier post Jasper ireport.

The code can be easily altered to render report in other types too.

Click

5 comments December 5, 2007

apache jboss static rendering

Long time back i have thought about this idea. But only few days back i had the oppurtunity to implement. With help of mod-jk, we are albe to comfirtably setup the worker processes. For this apache behaves as the primary webserver to which the request is pointed to. I have seen in many cases where static htmls are still devlivered or handled by the application servers like jboss working behind. It’s just a hit/miss story. So why dont we just have the static html in the apache server and deliver it to the client.

There have been questions on this subject/setup of delivering pages to clients. Since the maintanance is a bit difficult and the software buldling does not entertain this way of setup generally. But i always feel that it’s not fair to allow application servers to server the html’s. One another concern opposing my point could be the authentication or security handles by the applications. But that can be easily avoided by having dynamic rendering and auth in the app and once the auth stuffs are over, it’s just the hits at the webserver. I feel this methodology is more efficient provided we have good engineering of the bundling process.

Add comment June 19, 2007


Blogroll

Category Cloud

ajax books Education free software linux Market opensource open standards OSS programming search servers services Uncategorized web

Archives