> -----Original Message-----
> From: Bryan Hunt [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 15, 2004 10:03 AM
> To: Struts Users Mailing List
> Subject: Re: Tiles, Validation and reuse of HTML Form
> 
> 
> I do it with a separate action for each use case. I find it 
> tedious but 
> have not found a better way.

Just curious...
How is this more then one use case?  Namely, the "Browse Catalog" use case?
I mean... if you have 6 sure you can code each page... but if you have 600.... yikes.
Actions could be something like:
/showCatalogPage.do?page=1   ShowCatalogPage
/showItem.do?item=1          ShowCatalogItem

> 
> --b
> 
> Josh Holtzman wrote:
> 
> >Hello All,
> >
> > 
> >
> >I've tried to search the list archives for previous threads 
> on this topic,
> >but it appears the search feature is not working.
> >
> > 
> >
> >We are building a simple website that offers about a half 
> dozen products for
> >sale. 
> >
> > 
> >
> >We have one dedicated page layout (the product page) that 
> contains a photo
> >and description of the product.  On this page there is also 
> a list of the
> >other 5 products.  By clicking on any one of these products, 
> the page is
> >refreshed, and the new product information appears in the 
> same layout.  Also
> >on this page is an HTML form that is used to add items to 
> the shopping cart.
> >>From this form a user can choose any one of the 6 products 
> from a select
> >menu, type a quantity, and submit the form.. To add items to 
> the shopping
> >cart.  This form is the same on all the product pages.
> >
> > 
> >
> >For the sake of GUI reuse and maintenance, we have 
> implemented the site with
> >tiles.  For this particular page we have created a base 
> template named
> >"website.product" containing the header, footer, body 
> layout, and html form
> >tiles.  For each of the 6 products we have extended this 
> base template, and
> >added a tile with the product photo, description, and price.
> >
> > 
> >
> >In the struts config file we created an Action element for 
> each of the 6
> >product pages.  For instance:
> >
> > 
> >
> ><action
> >
> >path="/products/lazydazy"
> >
> >       parameter="website.product.lazydazy"
> >
> >       scope="request"
> >
> >       type="org.apache.struts.actions.ForwardAction"
> >
> >       validate="false">
> >
> ></action>
> >
> > 
> >
> >And
> >
> > 
> >
> ><action
> >
> >path="/products/sallysue"
> >
> >       parameter="website.product.sallysue"
> >
> >       scope="request"
> >
> >       type="org.apache.struts.actions.ForwardAction"
> >
> >       validate="false">
> >
> ></action>
> >
> > 
> >
> >The following is our dilemma:
> >
> > 
> >
> >We are using the same tile containing the html form (which 
> we declared in
> >the base template) for all these pages.  This doesn't 
> present any problem,
> >except when validation fails.  When the validation fails, Struts must
> >determine which page to return and display the error 
> message.  But our
> >problem is, the Action element requires we specify a single location.
> >
> > 
> >
> ><action
> >
> >path="/addtocart"
> >
> >      input="website.product.lazydazy"
> >
> >      name="addToCartForm"
> >
> >      scope="request"
> >
> >      type="com.americandatacorp.struts.action.cart.Add"
> >
> >      validate="true">
> >
> >      <forward name="Success" path="website.default.cart.success"
> >redirect="true"/>
> >
> ></action>
> >
> > 
> >
> >But if an item is added to the cart from the 
> "website.product.sallysue"
> >template, and validation fails, the user is returned to the
> >"website.product.lazydazy" page with the error displayed.
> >
> > 
> >
> >Does anyone have any suggestions, other than having to 
> create a seperate
> >"addtocart" action for every page?
> >
> > 
> >
> >Thank you for your assistance in advance.
> >
> > 
> >
> >Josh Holtzman
> >
> > 
> >
> >AMERICAN DATA COMPANY
> >
> >Developing and Supporting your Online Applications
> >
> > 
> >
> >[EMAIL PROTECTED]
> >
> >Voice: (310) 470-1257
> >
> >Fax:    (310) 362-8454
> >
> > 
> >
> >Sun Microsystems iForce Partner
> >
> > 
> >
> >
> >  
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to