Advertisement
Advertisement
| 04.03.2008 at 09:01AM PDT, ID: 23293264 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: |
<%-- Import libaries required for sql and parameter lists --%>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<HTML>
<HEAD> <TITLE> The Billing Code JSP </TITLE>
</HEAD>
<BODY BGCOLOR=white>
<%-- Hard code connection string to DEVL for now --%>
<%
connStr = "jdbc:<host>:1521:<SID>";
%>
<B>Enter a Billing Code:</B>
<FORM METHOD=post>
<%= BCQuery(connStr) %>
<INPUT TYPE="submit" VALUE="Enter Billing Code");
<BR>
<% String searchCondition = request.getParameter("cond");
if (searchCondition != null) { %>
<H3> Search results for Billing Code : <I> <%= searchCondition %> </I> </H3>
<%= runQuery(connStr,searchCondition) %>
<HR><BR>
<% } %>
</FORM>
<HR>
<%-- Show parameter names and values - remove after testing --%>
<B>Form Content</B><BR>
<TABLE>
<% Enumeration parameters = request.getParameterNames();
while(parameters.hasMoreElements()){
String parameterName = (String)parameters.nextElement();
String parameterValue = request.getParameter(parameterName); %>
<TR>
<TD><%=parameterName%></TD>
<TD><%=parameterValue%></TD>
</TR>
<% } %>
</BODY>
</HTML>
<%-- Query and result formatting funtions --%>
<%!
private String BCQuery(String connStr) throws SQLException {
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(connStr,
"user", "pwd");
stmt = conn.createStatement();
rset = stmt.executeQuery("SELECT ROLLUP_LEVEL3 FROM CWOF_ROLLUP_LEVEL3_VW ORDER BY ROLLUP_LEVEL3 ASC");
return (htmlSelect(rset));
} catch (SQLException e) {
return ("<P> SQL error: <PRE> " + e + " </PRE> </P>\n");
} finally {
if (rset!= null) rset.close();
if (stmt!= null) stmt.close();
if (conn!= null) conn.close();
}
}
private String runQuery(String connStr, String cond) throws SQLException {
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(connStr,
"user", "pwd");
stmt = conn.createStatement();
rset = stmt.executeQuery("SELECT ROLLUP_LEVEL3 \"Billing Code\", DESCRIPTION \"Description\", ITEM_CODE \"Item Code\", INCOME_ACCOUNT \"Income Account\" FROM CWOF_BILLING_CODE_VW "+
(cond.equals("") ? "" : "WHERE ROLLUP_LEVEL3=" +"'" + cond + "'"));
return (formatResult(rset));
} catch (SQLException e) {
return ("<P> SQL error: <PRE> " + e + " </PRE> </P>\n");
} finally {
if (rset!= null) rset.close();
if (stmt!= null) stmt.close();
if (conn!= null) conn.close();
}
}
private String formatResult(ResultSet rset) throws SQLException {
StringBuffer sb = new StringBuffer();
ResultSetMetaData metaData = rset.getMetaData();
int columnCount = metaData.getColumnCount();
sb.append("<table border=\"1\" cellpadding=\"5\">");
sb.append("<tr>");
for (int i = 1; i <= columnCount; i++)
sb.append("<td><b>" + metaData.getColumnName(i) + "</td>");
sb.append("</tr>");
while (rset.next()){
sb.append("<tr>");
for (int i = 1; i <= columnCount; i++)
sb.append("<td>" + rset.getString(i) + "</td>");
}
sb.append("</tr>");
sb.append("</TABLE>");
return sb.toString();
}
private String htmlSelect(ResultSet rset ) throws SQLException {
StringBuffer sb = new StringBuffer();
if(rset.next()){
sb.append("<SELECT NAME='cond' SIZE='1'>");
do {
sb.append("<OPTION>" + rset.getString(1) + "</OPTION>");
} while (rset.next());
sb.append("</SELECT>");
}
return sb.toString();
}
%>
|
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 04.03.2008 at 09:38AM PDT, ID: 21274360 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: |
private String formatResult(ResultSet rset) throws SQLException {
StringBuffer sb = new StringBuffer();
ResultSetMetaData metaData = rset.getMetaData();
int columnCount = metaData.getColumnCount();
sb.append("<table border=\"1\" cellpadding=\"5\">");
sb.append("<tr>");
// Ravs - append header column for radio button
sb.append('<td>Check</td>');
for (int i = 1; i <= columnCount; i++)
sb.append("<td><b>" + metaData.getColumnName(i) + "</td>");
sb.append("</tr>");
while (rset.next()){
sb.append("<tr>");
// Ravs - append radio button
sb.append('<td><input type="radio"...></td>');
for (int i = 1; i <= columnCount; i++)
sb.append("<td>" + rset.getString(i) + "</td>");
}
sb.append("</tr>");
sb.append("</TABLE>");
return sb.toString();
}
|
| 04.03.2008 at 09:42AM PDT, ID: 21274398 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: |
<script type="text/javascript">
function addRadio() {
var tbl = document.getElementById("table1")
tbl.rows[0].insertCell(0); // add cell to beginning of header row
for (i=1;i<tbl.rows.length;i++) {
theRow = tbl.rows[i];
theRow.insertCell(0); // add cell to beginning of each row
theRow.cells[0].innerHTML = "<input type='radio' name='radioSel' id='radio" + i + "' onclick='radioClick(this);' />"; // insert the radio button
}
}
function radioClick(obj) {
//unhighlight all rows
var tbl = document.getElementById("table1")
for (i=1;i<tbl.rows.length;i++) {
tbl.rows[i].style.backgroundColor = "";
}
// highlight the selected row
tbl.rows[obj.id.substr(5)].style.backgroundColor="yellow";
}
</script>
|
| 04.03.2008 at 10:07AM PDT, ID: 21274637 |
| 04.03.2008 at 10:33AM PDT, ID: 21274880 |
| 04.03.2008 at 10:34AM PDT, ID: 21274886 |
| 04.03.2008 at 10:41AM PDT, ID: 21274948 |
| 04.03.2008 at 12:53PM PDT, ID: 21276292 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: |
function radioClick(obj) {
//unhighlight all rows
var tbl = document.getElementById("table1");
var theRow = tbl.rows[obj.id.substr(5)];
for (i=1;i<tbl.rows.length;i++) {
tbl.rows[i].style.backgroundColor = "";
}
// highlight the selected row
theRow.style.backgroundColor="yellow";
// compile the selected data
var sValue = "";
for (i=1;i<theRow.cells.length;i++) {
if (i>1) sValue += "~";
sValue += tbl.rows[0].cells[i].innerHTML + ":" + theRow.cells[i].innerHTML;
}
alert(sValue);
// copy the data to the parent frames
parent.document.forms[0].tbldata.value = sValue;
}
|
| 04.03.2008 at 01:37PM PDT, ID: 21276714 |
| 04.03.2008 at 02:04PM PDT, ID: 21276954 |