This is your syntax error:
session.setAttribute("chkValues2",chkValues[]); //AND NOW MAY BE ADDED TO CART
it should be
session.setAttribute("chkValues2",chkValues); //AND NOW MAY BE ADDED TO CART
Regards,
Richard
At 11:13 PM 12/14/2001 -0700, you wrote:
>Help! I've been working on this for 4 days, but I'm sure it's simple if
>you are experienced. I'm receiving an error when I try to create the
>session variable (line 29)
>
>I just want to
>A) take the record ID's from a string variable on a sort page,
>B) create a string session variable which has those ID's
>C) and then pass it to the cart page, where the ID's will be used to
>display multiple records.
>
>1) (From the sort page), using an ADD TO CART BUTTON, Pass the record ID's
>in the String chkValues[] to a session variable.
>
>2)Figure out how to be able to access that session variable from the cart
>page: (The issue is that the form on the sort page already uses a GET
>method to perform the sort.)
>--------------------------------------
>ERROR
>500 Internal Server Error - /jserv/Detail2.jsp:
>Compilation error occured:
>Found 2 errors in JSP file:
>C:\\Inetpub\\wwwroot\\Beachwear\\jserv\\Detail2.jsp:27: Syntax: Expression
>expected after this token
>--------------------------------------------
><%@page language="java" import="java.sql.*"%>
><%@ include file="../Connections/connBeachwear.jsp" %>
><%@page language="java" import="java.sql.*,java.util.*"%><%//ADDED 12/14 %>
><%
>//INCLUDE 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_USERNAME,MM_connBeachwear_PASSWORD);
>String chkValues[]=request.getParameterValues("valueCheckbox");
>
>session.setAttribute("chkValues2",chkValues[]); //AND NOW MAY BE ADDED TO CART
>
>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">Go to Cart</div>
></div>
></td>
></tr>
><tr>
><td width="20%">
><div align="center">
><input type="submit" value="Sort /Select" name="submit">
></div>
></td>
><td width="19%">
><div align="center">
><select name="order" size="1">
><option value="ID" <% if (rsBeachwear__orderby.equals("ID"))
>{out.print("selected"); } %> >ID</option>
><option value="Item" <% if (rsBeachwear__orderby.equals("Item"))
>{out.print("selected"); } %> >Item</option>
><option value="Color" <% if (rsBeachwear__orderby.equals("Color"))
>{out.print("selected"); } %> >Color</option>
><option value="Size" <% if (rsBeachwear__orderby.equals("Size"))
>{out.print("selected"); } %> >Size</option>
></select>
></div>
></td>
><td width="25%">
><div align="center">
><select name="sort" size="1">
><option value="ASC" <% if (rsBeachwear__sortby.equals("ASC"))
>{out.print("selected"); } %>>Ascending</option>
><option value="DESC" <% if (rsBeachwear__sortby.equals("DESC"))
>{out.print("selected"); } %>>Descending</option>
></select>
></div>
></td>
><td width="36%">
><div align="center">
><input type="submit" name="Submit" value="Add to Cart">
></div>
></td>
><td width="36%">
><div align="center">
><div align="center">
><input type="button" name="butGoToCart" value="Go to Cart"
>onClick="window.location='../jserv/Cart2.jsp'">
></div>
></div>
></td>
></tr>
></table>
><p>�</p>
><%while(rsBeachwear.next()){%>
><table width="75%" border="1">
><tr>
><td width="17%">ID:</td>
><td width="58%"><%=(((rsBeachwear_data =
>rsBeachwear.getObject("ID"))==null ||
>rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
><td width="25%">
><div align="center">Include in Sort:
><input type="checkbox" name="valueCheckbox" value="<%=(((rsBeachwear_data
>= rsBeachwear.getObject("ID"))==null ||
>rsBeachwear.wasNull())?"":rsBeachwear_data)%>" checked>
></div>
></td>
></tr>
><tr>
><td width="17%">ITEM:</td>
><td colspan="3"><%=(((rsBeachwear_data =
>rsBeachwear.getObject("Item"))==null ||
>rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
></tr>
><tr>
><td width="17%">COLOR:</td>
><td colspan="3"><%=(((rsBeachwear_data =
>rsBeachwear.getObject("Color"))==null ||
>rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
></tr>
><tr>
><td width="17%">SIZE:</td>
><td colspan="3"><%=(((rsBeachwear_data =
>rsBeachwear.getObject("Size"))==null ||
>rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
></tr>
><tr>
><td width="17%" bgcolor="#00FFFF" bordercolor="#FFFFFF">
><div align="left"></div>
></td>
><td colspan="3" bgcolor="#00FFFF" bordercolor="#FFFFFF">� </td>
></tr>
></table>
><%
>}
>%>
><p>�</p>
></form>
><%
>rsBeachwear.close();
>ConnrsBeachwear.close();
>%>
>
>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
==========================================================================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