Dennis’s Weblog


Posted on: October 11, 2008

<%@ page language=”java” contentType=”text/html; charset=UTF-8″
        import=”java.sql.*”you should download the connector to connect to mysql from jsp.

Here we can know how to import java library to JSP

<%@ taglib uri=”” prefix=”display” %>

It use some java Decorator, it’s a free library.     Display:table   library.

It can do sorting, exporting, and many other thing,  —-Decorator Design Pattern, just for decorate the data, for example, in database data, a date :1908.09.20, and this Decorator class can transform it to 1908年09月20日.


Here we can know the most important part to

Connection con = null;
Statement stmt = null;
ResultSet rs;
String sql = “”;
List resultList = new ArrayList();

String reqType=”S”;
if (request.getParameter(“r”)!=null)
 reqType = request.getParameter(“r”);

use request.getParameter(“r”) to get the value send by Html form, as blow “green color”
String url=””;variables
if (reqType.equals(“S”))
 url = “<font color=’red’ size=’3′>Success</font>&nbsp;<a href=‘/report.jsp?r=P’>Pending</a>”;
else if (reqType.equals(“P”))
 url = “<a href=’/report.jsp?r=S’>Success</a>&nbsp;<font color=’red’ size=’3′>Pending</font>”;

try {
    Class.forName(“com.mysql.jdbc.Driver”).newInstance();create instance
    con = DriverManager.getConnection(“jdbc:mysql:///apccas2008″,”root”, “”);//use the driver connect to database mysql, and JSP programm just direct connect to Drive on local machine, this is much quicker than direct connect to mysql database (ODBC have the same sense)

    if(!con.isClosed()) {
  sql = “Select * from payment where paymentstatus='” + reqType + “‘ order by id desc”;
  rs = stmt.executeQuery(sql);
  while ( {

   Payment payment = new Payment();
  } catch(Exception e) {
  } finally {
    try {
      if(con != null)
    } catch(SQLException e) {

request.setAttribute( “paymentList”, resultList);
 <title>APCCAS 2008 Report</title>
 <link href=”css/screen.css” rel=”stylesheet” type=”text/css” />

the library refer to previously
<display:table name=”paymentList” export=”true” class=”ISIS” pagesize=”20″ defaultsort=”1″ defaultorder=”descending” decorator=””>
     APCCAS 2008 Registration – <%=url %>     
 <display:column property=”id” title=”ID”/>
 <display:column property=”userid” title=”User id”/>
 <display:column property=”amount” title=”Amount(MOP)”/>
 <display:column property=”amount_usd” title=”Amount(USD)”/>
 <display:column property=”paymentmethod” title=”Payment Method”/>
 <display:column property=”paymentstatus” title=”Payment Status”/>
 <display:column property=”serialno” title=”Serial No”/>
 <display:column property=”txn_date_time” title=”Date”/>  
 <display:column property=”title” title=”Title”/>
 <display:column property=”con_priceclass” title=”Price Class”/>  
 <display:column property=”ticket1″ title=”Welcome Reception”/>
 <display:column property=”ticket2″ title=”Conference Banquet”/>
 <display:column property=”paperid” title=”Paper id”/>
 <display:column property=”tut_role” title=”Tutorial Identity”/>
 <display:column property=”tutorial” title=”Tutorial”/>


<p align=”center”>
Generated by Mango Conference System


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


  • None
%d bloggers like this: