Greetings all! I am currently working on my first website and have some questions! One of my cow-orkers actually had a "mini" version of what I need, so I'm trying to modify that instead of starting from scratch.
So, the main page of the website lists a bunch of statutes that come from DB2 (iSeries) tables. I would like to add "filtering" to this main page so that the user can select just active statutes, or where the origin is the County or the State or what ever agency enforces the statute.
So, the first page is the index page:
which opens the access.jsp page:
which finally gets us to the main page:
So how do I from listRows.jsp add a radio button group:
[tt]o Active o Inactive o All[/tt]
and then recall the access.jsp with the correct criteria in the SQL?
Like I said, someone else has done most of this...I'd actually like it to default to just the Active statutes, and only show the Inactive only upon request when the radio button is selected and the page refreshed. Any pointers will be greatly appreciated!
Leslie
Have you met Hardy Heron?
So, the main page of the website lists a bunch of statutes that come from DB2 (iSeries) tables. I would like to add "filtering" to this main page so that the user can select just active statutes, or where the origin is the County or the State or what ever agency enforces the statute.
So, the first page is the index page:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<%
session.setAttribute("currentRecord","0");
session.setAttribute("message","");
String URL = "access.jsp";
request.getRequestDispatcher(URL).forward(request,response);
%>
</body>
</html>
which opens the access.jsp page:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page
import="java.sql.*,functions.*,java.util.ArrayList"
language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<%
String library = JDBCdefs.getLibrary();
ArrayList statuteList = new ArrayList();
String dataRow = "";
try
{
jdbcAccess datasource = new jdbcAccess();
datasource.connect();
Connection conn = datasource.getConnection();
Statement sqlstmt = conn.createStatement();
String stmt = "SELECT E.STATUT, E.CHGABV, M.CHGDSC, E.CHGDSCL FROM " + library + "CMPSTAMFE E INNER JOIN " + library + "CMPSTAMF M ON E.STATUT = M.STATUT AND E.CHGABV " +
"= M.CHGABV ORDER BY STATUT, CHGABV";
ResultSet statutes = sqlstmt.executeQuery(stmt);
while(statutes.next())
{
dataRow = statutes.getString("STATUT") + "%";
dataRow = dataRow + statutes.getString("CHGABV") + "%";
dataRow = dataRow + statutes.getString("CHGDSC") + "%";
dataRow = dataRow + statutes.getString("CHGDSCL") + "%";
statuteList.add(dataRow);
}
sqlstmt.close();
statutes.close();
conn.close();
}
catch (SQLException sql)
{
System.out.println("statute Access - Sql Exception: " + sql.getMessage());
}
JDBCdefs.setStatutes(statuteList);
String URL = "listRows.jsp";
request.getRequestDispatcher(URL).forward(request,response);
%>
</body>
</html>
which finally gets us to the main page:
Code:
<html>
<head>
<%@ page
import="java.util.ArrayList"
import="functions.*,java.util.StringTokenizer"
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
<title>NM Statute Maintenance List</title>
<link href="theme/Master.css" rel="stylesheet" type="text/css" />
</head>
<body>
<%
ArrayList statuteList = new ArrayList();
String dataRow = "";
String strIndex = (String) session.getAttribute("currentRecord");
int index = Integer.parseInt(strIndex);
statuteList = JDBCdefs.getStatutes();
String statute = "", abbrev = "", descrip = "", descripL = "";
%>
<div id="list">
<h1 align="center">Metropolitan Court<br>Statute List</h1>
<h4 align="center">Select Statute to modify by clicking on the Row#.</h4>
<table border="1" width="100%" cellpadding="2" cellspacing="2">
<tr>
<td colspan='5'>Number of Items: <%= statuteList.size() %></td>
</tr>
<tr>
<td>Row#</td>
<td>Statute Id.</td>
<td>Abbrev.</td>
<td>Standard Description</td>
<td>Extended Description</td>
</tr>
<%
for (int i=0; i < statuteList.size(); i++)
{
dataRow = statuteList.get(i).toString();
StringTokenizer token = new StringTokenizer(dataRow,"%");
statute = token.nextToken();
abbrev = token.nextToken();
descrip = token.nextToken();
descripL = token.nextToken();
%>
<tr>
<td><a href="process.jsp?formtype=list&rowNbr=<%= i %>"><%= i %></a></td>
<td><%= statute.trim() %></td>
<td><%= abbrev.trim() %></td>
<td><%= descrip.trim() %></td>
<td><%= descripL.trim() %></td>
</tr>
<%
}
%>
</table>
</div>
</body>
</html>
So how do I from listRows.jsp add a radio button group:
[tt]o Active o Inactive o All[/tt]
and then recall the access.jsp with the correct criteria in the SQL?
Like I said, someone else has done most of this...I'd actually like it to default to just the Active statutes, and only show the Inactive only upon request when the radio button is selected and the page refreshed. Any pointers will be greatly appreciated!
Leslie
Have you met Hardy Heron?