I have three JSP pages,
1) a Search page
2) a "Select from Summary Record" Page (multiple summary records displayed, a box is 
checked for each you want the detail on.
3) a detail sort page (displays detail on multiple records,  you uncheck the 
checkboxes and press SELECT/SORT to remove records from the sort.

The detail sort page works perfectly, but needs additional functionality. It displays 
only the records that have "checks" in the checkboxes.  By unchecking the checkbox for 
individual records, (and then pressing the Sort/Select button), the sort is re-run 
using only the ID's of records that have been "checked."

WHAT I NEED FOR THE DETAIL PAGE:  When ADD TO CART is pressed, I want to pass the 
record ID's from the displayed records to a persistent session variable.   And then 
when "DISPLAY  CART" is pressed, I want to view a sort page EXACTLY like the original 
sort page, EXCEPT that the variable holding the diplayed record ID's IS the persistent 
session variable. I'm not sure how you can add only  unique ID's to the session 
variable (I don't want the cart to display duplicate records).

Here is the Detail(sort) Page code:
-----------------------------------------------------
<%@page language="java" import="java.sql.*"%>
<%@ include file="../Connections/connBeachwear.jsp" %>
<%@page language="java" import="java.sql.*,java.util.*"%>

<%//INCLUDES CHECKED ITEMS IN SORT:
String rsBeachwear__varCheckbox = "1";
if (request.getParameter ("valueCheckbox")    !=null)
{rsBeachwear__varCheckbox = (String)request.getParameter ("valueCheckbox")
;}
%>

<%
String rsBeachwear__name = "ID";//default sort value
 if (request.getParameter ("order") !=null) {rsBeachwear__name =
(String)request.getParameter ("order");}
String rsBeachwear__sort = "ASC";//default sort value
 if (request.getParameter ("sort") !=null) {rsBeachwear__sort =
(String)request.getParameter ("sort");}

String rsBeachwear__orderby ="ID";//default value
 if (request.getParameter ("order") !=null) {rsBeachwear__orderby =
(String)request.getParameter("order");}
String rsBeachwear__sortby ="ASC";//default value
 if (request.getParameter ("sort") !=null) {rsBeachwear__sortby =
(String)request.getParameter("sort");}
%>
<%
Driver DriverrsBeachwear =
(Driver)Class.forName(MM_connBeachwear_DRIVER).newInstance();
Connection ConnrsBeachwear =
DriverManager.getConnection(MM_connBeachwear_STRING,MM_connBeachwear_USERNAM
E,MM_connBeachwear_PASSWORD);
String chkValues[]=request.getParameterValues("valueCheckbox");

session.setAttribute("chkValues2",chkValues);  //IS THIS THE CORRECT WAY TO
ADD ID'S TO A SESSION VARIABLE?

StringBuffer prepStr=new StringBuffer("SELECT ID, Item, Color, Size FROM
Beachwear WHERE ID=");
for(int x = 0; x < chkValues.length; ++x) {
 prepStr.append(chkValues[x]);
 if((x+1)<chkValues.length){
  prepStr.append(" OR ID=");
  }//end if
 }//end for loop

 prepStr.append(" ORDER BY " + rsBeachwear__name + " " +
rsBeachwear__sort ); //NEW SQL SORT CODE:
PreparedStatement
StatementrsBeachwear=ConnrsBeachwear.prepareStatement(prepStr.toString());
ResultSet rsBeachwear = StatementrsBeachwear.executeQuery();
Object rsBeachwear_data;
%>
<title>Beachwear Title</title>
<body bgcolor="#FFFFFF">
<p align="center"><b><font size="4">DETAIL PAGE</font></b></p>
<form name="form1" method="get" action="Detail2.jsp">
  <table width="75%" border="1">
    <tr>
      <td width="20%">
        <div align="center">Sort Parameter </div>
      </td>
      <td width="19%">
        <div align="center">Sort 1</div>
      </td>
      <td width="25%">
        <div align="center">Sort 2</div>
      </td>
      <td width="36%">
        <div align="center">Add Records to Cart:</div>
      </td>
      <td width="36%">
        <div align="center">
          <div align="center">View Cart</div>
        </div>
      </td>
    </tr>
    <tr>
      <td width="20%">
        <div align="center">
          <input type="submit"

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to