Thanks, Chris.

Thanks for the recommendations! I use WROX Professional JSP-2nd Edition. I don't think 
I expressed myself clearly.  My code works well. My prob is I can't figure out how to 
add ANOTHER submit button to pass a string variable out of the form and into the cart 
page without causing an exception.

Thanks again, Michael

----- Original Message -----
From: "Chris Tucker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 12, 2001 5:35 PM
Subject: Re: Advanced programmers: How can I add cart functionality to this
page?


> Michael,
> I'd suggest that the first thing you do is get some good books on JSP,
Java,
> and application development for the web.  It's unlikely anyone will be
able
> to afford the time to go through your code, work out what it's doing, pick
> out how to do what you need to do, and then tell you how to do it.  Take a
> look at Hans' book on JSP (O'Reillys "JavaServer Pages") as everyone seems
> to like that (though I haven't personally used it yet).  For a Java book,
> the traditional university text when I was at uni was Deitel & Deitel's
Java
> book (can't remember the title or publisher), and while not the best
> textbook ever will cover everything you need to get a really firm
foundation
> in the nicer points of Java.  As for web app development, not sure: I tend
> to spend a lot of time using the specs etc. from w3.org directly, as
they're
> the reference from which a lot of this stuff is implemented (that is, this
> "web" stuff -- the JSP/Servlet/J2EE etc. specs are all on java.sun.com).
>
> Sorry I can't be of more help,
>
> --Chris
>
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Michael
> Sent: Wednesday, December 12, 2001 3:19 PM
> To: [EMAIL PROTECTED]
> Subject: Advanced programmers: How can I add cart functionality to this
> page?
>
>
> The code is below.
> I've successfully coded a  repeating-record detail page with pull-down
sort
> boxes. Though the page works perfectly, I need to add cart functionality,
> and would like to keep it simple. I would simply like to have clients view
> the repeating details, sort the records, and then select each record
desired
> to be placed in a cart.
>
> Where do I start???
> ------------------------------------------------------
> Repeating Detail Page: Needs Cart
>
> <%@page language="java" import="java.sql.*"%>
> <%@ include file="../Connections/connBeachwear.jsp" %>
> <%
> String rsBeachwear__varCheckbox = "1";
> String rsBeachwear__showCheckbox = "no";
> 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");
> 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 );
> PreparedStatement
> StatementrsBeachwear=ConnrsBeachwear.prepareStatement(prepStr.toString());
> ResultSet rsBeachwear = StatementrsBeachwear.executeQuery();
> Object rsBeachwear_data;
> %>
> <title>Beachwear Title</title>
> <body bgcolor="#FFFFFF">
> <p>&nbsp;</p>
> <p>&nbsp;</p>
> <p><br>
>   INVOICE<br>
> </p>
> <%//FORM "GET" METHOD<%>
> <form name="form1" method="get" action="Invoice.jsp">
>   <p align="center">
>   </p>
>   <%while(rsBeachwear.next()){  ;  %>
>   <table width="75%" border="1">
>     <tr>
>       <td width="8%">ID:</td>
>       <td width="69%"><%=(((rsBeachwear_data =
> rsBeachwear.getObject("ID"))==null ||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
>       <td width="23%">
>         </div>
>       </td>
>     </tr>
>     <tr>
>       <td width="8%">ITEM:</td>
>       <td colspan="2"><%=(((rsBeachwear_data =
> rsBeachwear.getObject("Item"))==null ||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
>     </tr>
>     <tr>
>       <td width="8%">COLOR:</td>
>       <td colspan="2"><%=(((rsBeachwear_data =
> rsBeachwear.getObject("Color"))==null ||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
>     </tr>
>     <tr>
>       <td width="8%">SIZE:</td>
>       <td colspan="2"><%=(((rsBeachwear_data =
> rsBeachwear.getObject("Size"))==null ||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
>     </tr>
>     <%
>   <tr>
>       <td width="8%">&nbsp;</td>
>       <td colspan="2">
>
>         <input type="checkbox" name="valueCheckbox"
> value="<%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null ||
> rsBeachwear.wasNull())?"":rsBeachwear_data)%>" checked>
>  </td>
>     </tr>
>    </table>
>   <%
>   }
>   %>
>   <p>&nbsp; </p>
>   <br>
>   <table width="54%" border="1">
>     <tr>
>       <td width="29%">
>         <div align="center">Parameter </div>
>       </td>
>       <td width="28%">
>         <div align="center">1</div>
>       </td>
>       <td width="43%">
>         <div align="center">2</div>
>       </td>
>     </tr>
>
>     <tr>
>       <td width="29%">
>         <div align="center">
>           <input type="submit" value="Sort Now">
>         </div>
>       </td>
>       <td width="28%">
>         <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="43%">
>         <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>
>     </tr>
>   </table>
>   </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
>

===========================================================================
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