jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Chaffee ...@toddbiz.com>
Subject Re: shopping cart
Date Mon, 23 Apr 2001 19:10:39 GMT
At 10:54 AM 04/23/01 -0700, you wrote:

>On Mon, 23 Apr 2001, Todd Chaffee wrote:
> > I don't have much yet :)  I wanted to see how much interest there is so I
> > can prioritize it.  I'm on the fence about going forward with it at this
> > point because I'm not sure if my client needs it but if there is enough
> > outside interest I will continue work on it.
> >
>I think the general idea of abstracting out the guts of a shopping cart
>is kind of interesting.  What I'm wondering, though, is:
>* Is there really such a thing as a "generic" set of functionality
>   that can be done this way, but still leave people the flexibility
>   to customize as needed for their own requirements?

I was thinking of using java interfaces so, for example, the product/item 
interface used by the shopping cart would have required attributes such as 
product id, description, and price.  Since it would be an interface the 
user would be able to extend the class to include additional attributes 
(such as "Size" below).

For example, to add to the cart:

<shop:cart id="theCart" />

<shop:cartItemAdd cart="theCart">
     <shop:productID><%= request.getParameter("productID") %></shop:productID>
     <shop:description><%= request.getParameter("description") 
     <shop:quantity><%= request.getParameter("quantity") %></shop:quantity>
     <shop:price><%= request.getParameter("price") %></shop:price>
     <shop:attribute name="Size"><%= request.getParameter("size") 

And to dump the contents of the cart you might have a jsp that looks like this:

<table, etc.>
<th, etc>
<shop:cartListContents cart="theCart" sort="itemProductID">
     <td><shop:itemProductID /></td>
     <td><shop:itemDescription /></td>

     <td><shop:itemAttribute name="Size" /></td>

        <td><shop:itemSalePrice /></td>

      <td><shop:itemRegularPrice /></td>

</table, etc.>

The tag library would be responsible for getting/setting the additional 
attributes such as "Size".  I guess using introspection.  This is all just 
theory at this point - no code yet.

>* Can you define all of the required functionality purely in a tag
>   library, without making assumptions about the underlying business
>   logic and/or web application framework?

My first thought was to build this just using a simple collection since a 
cart is really just a specialized collection (add, remove, empty, copy, 
etc.).  The cart functionality itself is actually very generic until you 
get down to the item/product level.

But then I started building a site for a client that will be using a jboss 
(ejb, cmp, etc) shopping cart and I got to wondering if I could "plug-in" 
some of the implementation for the shopping cart such as the collection 
part of the cart. I'm thinking a java interface again.  The cart 
"collection" would be a java interface with a default implementation using 
a simple collection (such as vector) handled in the tag code itself.  But 
with the ability to plug-in your own cart back-end collection I'm thinking 
it might be possible to satisfy most business logic/web application 
frameworks.  On the other hand, I'm new to tags this so maybe this is a bit 
ambitious :)

- Todd Chaffee

> > - Todd Chaffee
> >
>Craig McClanahan
> > At 11:48 PM 04/19/01 -0400, you wrote:
> > >On Thu, 12 Apr 2001, Todd Chaffee wrote:
> > >
> > > > I am developing a Shopping Cart tag library for one of my 
> projects.  Would
> > > > there be any interest in adding this to taglibs?  Is anyone already
> > > working
> > > > on this?
> > >
> > >I'd personally be interested to see what you've got.  If you package it up
> > >in a way we can test it, I'm sure that'd be appreciated by us and our
> > >users.
> > >
> > >Best,
> > >
> > >Shawn
> >
> >

View raw message