Modified: incubator/beehive/trunk/samples/petstoreWeb/account/create/create.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/account/create/create.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/account/create/create.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/account/create/create.jsp Tue Apr 12 16:13:55 2005 @@ -53,7 +53,64 @@ </td> </tr> </table> - <beehive-petstore:accountFields categoryNames="${pageInput.accountFields}" languages="${pageInput.languages}"/> + <!-- beehive-petstore:accountFields categoryNames="${pageInput.accountFields}" languages="${pageInput.languages}"/ --> + <netui:span styleClass="boldlabel" value="${bundle.default.accountInformation}"/> + <table class="tablegreen"> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.firstName}:"/></td> + <td class="celldata"> + <netui:textBox dataSource="actionForm.firstName"/> + <br/> + <netui:error key="firstName"/> + </td> + </tr> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.lastName}:"/></td> + <td class="celldata"> + <netui:textBox dataSource="actionForm.lastName"/> + <br/> + <netui:error key="lastName"/> + </td> + </tr> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.email}:"/></td> + <td class="celldata"> + <netui:textBox dataSource="actionForm.email" size="40"/> + <br/> + <netui:error key="email"/> + </td> + </tr> + </table> + + <netui:span styleClass="boldlabel" value="${bundle.default.profileInformation}"/> + + <table class="tablegreen"> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.languagePreference}:"/></td> + <td class="celldata"> + <netui:select dataSource="actionForm.langPref" optionsDataSource="${pageInput.languages}"/> + </td> + </tr> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.favoriteCategory}:"/></td> + <td class="celldata"> + <netui:select dataSource="actionForm.favCategory" optionsDataSource="${pageInput.categoryNames}"/> + </td> + </tr> + <tr class="rowyellow"> + <td colspan=2> + <netui:checkBox dataSource="actionForm.myListOpt"/> + <netui:span value="${bundle.default.enableMyList}"/> + </td> + </tr> + <tr class="rowyellow"> + <td colspan=2> + <netui:checkBox dataSource="actionForm.bannerOpt"/> + <netui:span value="${bundle.default.enableMyBanner}"/> + </td> + </tr> + </table> + </td> </tr> </table>
Modified: incubator/beehive/trunk/samples/petstoreWeb/account/edit/Controller.jpf URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/account/edit/Controller.jpf?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/account/edit/Controller.jpf (original) +++ incubator/beehive/trunk/samples/petstoreWeb/account/edit/Controller.jpf Tue Apr 12 16:13:55 2005 @@ -24,14 +24,13 @@ import org.apache.struts.action.ActionMapping; import org.apache.beehive.netui.pageflow.Forward; -import org.apache.beehive.samples.petstore.controls.exceptions.NoSuchOrderException; import org.apache.beehive.samples.petstore.model.*; import org.apache.beehive.samples.petstore.controls.*; +import org.apache.beehive.samples.petstore.controls.exceptions.DataStoreException; import org.apache.beehive.samples.petstore.controls.exceptions.InvalidIdentifierException; import org.apache.beehive.samples.petstore.controls.exceptions.NoSuchAccountException; import org.apache.beehive.samples.petstore.controls.exceptions.NoSuchUserException; import org.apache.beehive.samples.petstore.forms.AccountForm; -import org.apache.beehive.samples.petstore.forms.OrderForm; import org.apache.beehive.samples.petstore.controller.AccountController; import org.apache.beehive.controls.api.bean.Control; @@ -43,7 +42,8 @@ @Jpf.MessageBundle(bundlePath = "org.apache.beehive.samples.petstore.resources.account") }, simpleActions={ - @Jpf.SimpleAction(name="begin", path="edit.jsp") + @Jpf.SimpleAction(name="begin", path="edit.jsp"), + @Jpf.SimpleAction(name="viewOrder", path = "/checkout/viewOrder.do") } ) public class Controller @@ -56,10 +56,10 @@ private AccountControl _accountControl; @Jpf.SharedFlowField(name="rootSharedFlow") - private webappRoot.SharedFlow _sharedFlow; + private webappRoot.SharedFlow _sharedFlow = null; private UpdateAccountForm _updateForm; - private Order[] orders; + private Order[] _orders; @Jpf.Action( forwards = { @@ -98,7 +98,8 @@ validationErrorForward = @Jpf.Forward(name = "failure", navigateTo = Jpf.NavigateTo.currentPage) ) protected Forward updateAccount(UpdateAccountForm form) - throws InvalidIdentifierException, NoSuchAccountException, NoSuchUserException { + throws InvalidIdentifierException, NoSuchAccountException, NoSuchUserException, DataStoreException + { _sharedFlow.ensureLogin(); Account account = AccountForm.getAccount(form); @@ -112,23 +113,6 @@ @Jpf.Action( forwards = { - @Jpf.Forward(name = "success", path = "/checkout/viewOrder.do") - } - ) - protected Forward viewOrder() - throws NoSuchOrderException { - _sharedFlow.ensureLogin(); - - Order order = _orderControl.getOrder(getRequest().getParameter("orderId")); - - OrderForm form = new OrderForm(); - form.setOrder(order); - - return new Forward("success", form); - } - - @Jpf.Action( - forwards = { @Jpf.Forward(name = "success", path = "listOrders.jsp", actionOutputs = { @Jpf.ActionOutput(name = "orders", @@ -137,13 +121,13 @@ }) } ) - protected Forward listOrders() { + protected Forward listOrders() throws DataStoreException { _sharedFlow.ensureLogin(); - orders = _orderControl.getOrdersByUserId(_sharedFlow.getAccount().getUserId()); + _orders = _orderControl.getOrdersByUserId(_sharedFlow.getAccount().getUserId()); Forward forward = new Forward("success"); - forward.addActionOutput("orders", orders); + forward.addActionOutput("orders", _orders); return forward; } Modified: incubator/beehive/trunk/samples/petstoreWeb/account/edit/edit.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/account/edit/edit.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/account/edit/edit.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/account/edit/edit.jsp Tue Apr 12 16:13:55 2005 @@ -37,16 +37,74 @@ </td> </tr> </table> - <beehive-petstore:accountFields categoryNames="${pageInput.categoryNames}" languages="${pageInput.languages}"/> + <netui:span styleClass="boldlabel" value="${bundle.default.accountInformation}"/> + <table class="tablegreen"> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.firstName}:"/></td> + <td class="celldata"> + <netui:textBox dataSource="actionForm.firstName"/> + <br/> + <netui:error key="firstName"/> + </td> + </tr> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.lastName}:"/></td> + <td class="celldata"> + <netui:textBox dataSource="actionForm.lastName"/> + <br/> + <netui:error key="lastName"/> + </td> + </tr> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.email}:"/></td> + <td class="celldata"> + <netui:textBox dataSource="actionForm.email" size="40"/> + <br/> + <netui:error key="email"/> + </td> + </tr> + </table> + + <netui:span styleClass="boldlabel" value="${bundle.default.profileInformation}"/> + + <table class="tablegreen"> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.languagePreference}:"/></td> + <td class="celldata"> + <netui:select dataSource="actionForm.langPref" optionsDataSource="${pageInput.languages}"/> + </td> + </tr> + <tr class="rowyellow"> + <td class="celldata"><netui:span value="${bundle.default.favoriteCategory}:"/></td> + <td class="celldata"> + <netui:select dataSource="actionForm.favCategory" optionsDataSource="${pageInput.categoryNames}"/> + </td> + </tr> + <tr class="rowyellow"> + <td colspan=2> + <netui:checkBox dataSource="actionForm.myListOpt"/> + <netui:span value="${bundle.default.enableMyList}"/> + </td> + </tr> + <tr class="rowyellow"> + <td colspan=2> + <netui:checkBox dataSource="actionForm.bannerOpt"/> + <netui:span value="${bundle.default.enableMyBanner}"/> + </td> + </tr> + </table> + </td> </tr> <tr> <td> <center> - <br/> <netui:imageButton src="${pageContext.request.contextPath}/images/button_submit.gif"/> <br/> <br/> + <netui:anchor action="rootSharedFlow.globalViewAddresses.do"> + <b>${bundle.default.listAddressesLabel}</b> + </netui:anchor><br/> <netui:anchor action="listOrders"> <b>${bundle.default.listOrdersLabel}</b> </netui:anchor> Modified: incubator/beehive/trunk/samples/petstoreWeb/account/edit/listOrders.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/account/edit/listOrders.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/account/edit/listOrders.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/account/edit/listOrders.jsp Tue Apr 12 16:13:55 2005 @@ -29,7 +29,9 @@ <netui-data:repeaterItem> <tr valign="top" class="rowyellow"> <td class="celldata"> - <netui:label value="${container.item.orderId}"/> + <netui:anchor action="viewOrder" value="${container.item.orderId}"> + <netui:parameter name="orderId" value="${container.item.orderId}"/> + </netui:anchor> </td> <td class="celldata"> <netui:span value="${container.item.orderDate}" defaultValue=" "/> Modified: incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf (original) +++ incubator/beehive/trunk/samples/petstoreWeb/auth/Controller.jpf Tue Apr 12 16:13:55 2005 @@ -22,6 +22,9 @@ import org.apache.beehive.netui.pageflow.Forward; import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.samples.petstore.controls.exceptions.DataStoreException; +import org.apache.beehive.samples.petstore.controls.exceptions.InvalidIdentifierException; +import org.apache.beehive.samples.petstore.controls.exceptions.NoSuchAccountException; import org.apache.beehive.samples.petstore.forms.ReturnToForm; @Jpf.Controller( @@ -67,7 +70,9 @@ ) } ) - protected Forward securityCheck(SecurityCheckForm form) { + protected Forward securityCheck(SecurityCheckForm form) + throws DataStoreException, InvalidIdentifierException, NoSuchAccountException + { _sharedFlow.handleLogin(form.getj_username()); if(!_sharedFlow.isUserLoggedIn()) Modified: incubator/beehive/trunk/samples/petstoreWeb/auth/login.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/auth/login.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/auth/login.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/auth/login.jsp Tue Apr 12 16:13:55 2005 @@ -7,6 +7,10 @@ <netui-template:section name="leftnav"> </netui-template:section> +<!-- Turn off the header menu --> +<style> +#main_menu {visibility: hidden;} +</style> <netui-template:section name="body"> <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> @@ -19,7 +23,7 @@ <netui:form action="securityCheck"> <table align="center" border="0"> <tr> - <td colspan="2">${bundle.view.enterUsernamePassword}<br/></td> + <td colspan="2"><b>${bundle.view.enterUsernamePassword}</b><br/></td> </tr> <tr> <td>${bundle.view.usernameLoginLabel}:</td> Modified: incubator/beehive/trunk/samples/petstoreWeb/checkout/Controller.jpf URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/checkout/Controller.jpf?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/checkout/Controller.jpf (original) +++ incubator/beehive/trunk/samples/petstoreWeb/checkout/Controller.jpf Tue Apr 12 16:13:55 2005 @@ -21,13 +21,16 @@ import org.apache.beehive.netui.pageflow.Forward; import org.apache.beehive.netui.pageflow.PageFlowController; +import org.apache.beehive.samples.petstore.controls.AddressControl; import org.apache.beehive.samples.petstore.controls.OrderControl; -import org.apache.beehive.samples.petstore.controls.CatalogControl; +import org.apache.beehive.samples.petstore.controls.exceptions.DataStoreException; import org.apache.beehive.samples.petstore.controls.exceptions.NoSuchOrderException; import org.apache.beehive.samples.petstore.controls.exceptions.InvalidIdentifierException; import org.apache.beehive.samples.petstore.controls.exceptions.OrderAlreadyExistsException; +import org.apache.beehive.samples.petstore.model.Address; +import org.apache.beehive.samples.petstore.model.LineItem; import org.apache.beehive.samples.petstore.model.Order; -import org.apache.beehive.samples.petstore.forms.OrderForm; +import org.apache.beehive.samples.petstore.model.OrderItem; import org.apache.beehive.samples.petstore.forms.CheckoutForm; import org.apache.beehive.controls.api.bean.Control; @@ -39,15 +42,16 @@ messageBundles={ @Jpf.MessageBundle(bundlePath="org.apache.beehive.samples.petstore.resources.order") }, - simpleActions={ - @Jpf.SimpleAction(name="viewItem", path="/shop/viewItem.do") + simpleActions={ + @Jpf.SimpleAction(name="viewItem", path="/shop/viewItem.do"), + @Jpf.SimpleAction(name="viewOrders", path="/account/edit/listOrders.do") } ) public class Controller extends PageFlowController { - @Control() - private CatalogControl _catalogControl; + @Control() + private AddressControl _addressControl; @Control() private OrderControl _orderControl; @@ -59,9 +63,7 @@ private CheckoutForm _orderForm = null; @Jpf.Action( - forwards={ - @Jpf.Forward(name="success", path="viewCart.jsp") - } + [EMAIL PROTECTED](name="success", path="viewCart.jsp")} ) public Forward begin() { @@ -69,39 +71,53 @@ } @Jpf.Action( - forwards={ - @Jpf.Forward(name="success", path="newOrder.jsp", - actionOutputs = { - @Jpf.ActionOutput(name = "creditCardTypes", - type = java.util.List.class, - required = true), - @Jpf.ActionOutput(name = "order", - type = org.apache.beehive.samples.petstore.model.Order.class, - required = true) - } - ) + [EMAIL PROTECTED](name="success", action="viewCreateOrder") } ) - protected Forward viewCreateOrder() + protected Forward createNewOrder() throws DataStoreException { _sharedFlow.ensureLogin(); - _order=_orderControl.createOrder(); - _order.initOrder(_sharedFlow.getAccount(), _sharedFlow.getCart()); + _sharedFlow.getAccount().setStatus("checking_out"); + _order = _orderControl.createOrder(); + _order.initOrder(_sharedFlow.getAccount().getUserId(), _sharedFlow.getCart()); - _orderForm=new CheckoutForm(); + _orderForm = new CheckoutForm(); _orderForm.setCheckOut(true); _orderForm.setOrder(_order); + _orderForm.setCart(_sharedFlow.getCart()); - Forward forward = new Forward("success"); - forward.addOutputForm(_orderForm); - forward.addActionOutput("order", _order); - forward.addActionOutput("creditCardTypes", _orderControl.getCreditCards()); - - return forward; + return new Forward("success"); } @Jpf.Action( + forwards={ + @Jpf.Forward(name="success", path="newOrder.jsp", + actionOutputs = { + @Jpf.ActionOutput(name = "creditCardTypes", + type = java.util.List.class, + required = true), + @Jpf.ActionOutput(name = "addresses", + type = org.apache.beehive.samples.petstore.model.Address[].class, + required = true) + } + ) + } + ) + protected Forward viewCreateOrder() throws DataStoreException + { + _sharedFlow.ensureLogin(); + + Forward forward = new Forward("success"); + forward.addOutputForm(_orderForm); + forward.addActionOutput("creditCardTypes", _orderControl.getCreditCards()); + forward.addActionOutput("addresses", _addressControl.getUserAddresses(_sharedFlow.getAccount().getUserId())); + + return forward; + } + + + @Jpf.Action( forwards={ @Jpf.Forward(name="done", returnAction="checkoutDone") } @@ -116,66 +132,57 @@ forwards={ @Jpf.Forward(name="confirm", path="confirm.jsp", actionOutputs = { - @Jpf.ActionOutput(name = "order", - type = org.apache.beehive.samples.petstore.model.Order.class, - required = true), - @Jpf.ActionOutput(name = "checkout", - type = java.lang.Boolean.class, - required = true) + @Jpf.ActionOutput(name = "lineItems", + type = org.apache.beehive.samples.petstore.model.LineItem[].class, + required = true), + @Jpf.ActionOutput(name = "order", + type = org.apache.beehive.samples.petstore.model.Order.class, + required = true), + @Jpf.ActionOutput(name = "shippingAddress", + type = org.apache.beehive.samples.petstore.model.Address.class, + required = true), + @Jpf.ActionOutput(name = "billingAddress", + type = org.apache.beehive.samples.petstore.model.Address.class, + required = true) }) - } + }, + [EMAIL PROTECTED](name="failure", navigateTo=Jpf.NavigateTo.currentPage) ) - protected Forward viewConfirm(CheckoutForm orderForm) + protected Forward viewConfirm(CheckoutForm orderForm) throws InvalidIdentifierException, DataStoreException { - Boolean isCheckOut=new Boolean(orderForm.isCheckOut()); + _sharedFlow.ensureLogin(); - Forward f=new Forward("confirm", orderForm); - f.addActionOutput("checkout", isCheckOut); + Address billingAddress = new Address(); + Address shippingAddress = new Address(); + + billingAddress = _addressControl.getAddress(orderForm.getOrder().getBillingAddress()); + shippingAddress = _addressControl.getAddress(orderForm.getOrder().getShippingAddress()); + + Forward f = new Forward("confirm"); f.addActionOutput("order", _order); + f.addActionOutput("lineItems", _sharedFlow.getCart().getLineItems()); + f.addActionOutput("billingAddress", billingAddress); + f.addActionOutput("shippingAddress", shippingAddress); + f.addOutputForm(_orderForm); return f; } @Jpf.Action( - useFormBean="_orderForm", - forwards={ - @Jpf.Forward(name="success", path="viewOrder.jsp", - actionOutputs = { - @Jpf.ActionOutput(name = "checkout", - type = java.lang.Boolean.class, - required = true), - @Jpf.ActionOutput(name = "order", - type = org.apache.beehive.samples.petstore.model.Order.class, - required = true) - }) - } + [EMAIL PROTECTED](name="success", action="viewOrder")} ) - protected Forward confirm(CheckoutForm orderForm) - throws NoSuchOrderException, InvalidIdentifierException, OrderAlreadyExistsException + protected Forward confirm() + throws NoSuchOrderException, InvalidIdentifierException, OrderAlreadyExistsException, DataStoreException { _sharedFlow.ensureLogin(); - Order order = orderForm.getOrder(); - _orderControl.commitOrder(order); - + // Write the order to the DB + int orderId = _orderControl.commitOrder(_order, _sharedFlow.getCart()); _sharedFlow.handleCheckout(); - - Boolean isCheckOut=new Boolean(orderForm.isCheckOut()); - - Forward f=new Forward("success"); - f.addActionOutput("order", _order); - f.addActionOutput("checkout", isCheckOut); - return f; - } - - @Jpf.Action( - useFormBean="_orderForm", - forwards={ - @Jpf.Forward(name="success", path="shipping.jsp") - } - ) - protected Forward viewShipping(CheckoutForm orderForm) - { - return new Forward("success", orderForm); + + // putting the orderId in the attributes flags this request as a new order + getRequest().setAttribute("orderId", orderId); + + return new Forward("success"); } @Jpf.Action( @@ -185,48 +192,63 @@ @Jpf.ActionOutput(name = "order", type = org.apache.beehive.samples.petstore.model.Order.class, required = true), - @Jpf.ActionOutput(name = "checkout", - type = java.lang.Boolean.class, - required = true) + @Jpf.ActionOutput(name = "lineItems", + type = org.apache.beehive.samples.petstore.model.LineItem[].class, + required = true), + @Jpf.ActionOutput(name = "shippingAddress", + type = org.apache.beehive.samples.petstore.model.Address.class, + required = true), + @Jpf.ActionOutput(name = "billingAddress", + type = org.apache.beehive.samples.petstore.model.Address.class, + required = true) }) } ) - protected Forward viewOrder(CheckoutForm form) + protected Forward viewOrder() throws NoSuchOrderException, DataStoreException, InvalidIdentifierException { _sharedFlow.ensureLogin(); - _order=form.getOrder(); - + + int orderId = -1; + boolean bNew = false; + + if (getRequest().getAttribute("orderId") == null) + { + // existing order coming in from the order list + orderId = Integer.parseInt(getRequest().getParameter("orderId")); + } else { + // New order, need to flag as such + orderId = (Integer)(getRequest().getAttribute("orderId")); + bNew = true; + } + + _order = _orderControl.getOrder(_sharedFlow.getAccount().getUserId(), orderId); + + if (bNew) + _order.setStatus("new"); + + Address billingAddress = new Address(); + Address shippingAddress = new Address(); + + billingAddress = _addressControl.getAddress(_order.getBillingAddress()); + shippingAddress = _addressControl.getAddress(_order.getShippingAddress()); + Forward f=new Forward("success"); - Boolean isCheckOut=new Boolean(form.isCheckOut()); - f.addActionOutput("checkout", isCheckOut); f.addActionOutput("order", _order); + f.addActionOutput("lineItems", getLineItems(_order.getOrderId())); + f.addActionOutput("billingAddress", billingAddress); + f.addActionOutput("shippingAddress", shippingAddress); return f; } - - @Jpf.Action( - useFormBean="_orderForm", - forwards={ - @Jpf.Forward(name="success", path="viewConfirm.do") + + private LineItem[] getLineItems(int orderId) throws DataStoreException + { + OrderItem[] orderItems = _orderControl.getOrderItemsByOrderId(orderId); + LineItem[] lineItems = new LineItem[orderItems.length]; + for (int i = 0; i < orderItems.length; i++) + { + lineItems[i] = new LineItem(orderId, i, orderItems[i]); + lineItems[i].setQuantity(orderItems[i].getQuantity()); } - ) - protected Forward shipping(OrderForm orderForm) - { - return new Forward("success", orderForm); - } - - @Jpf.Action( - useFormBean="_orderForm", - forwards={ - @Jpf.Forward(name="viewShipping", path="viewShipping.do"), - @Jpf.Forward(name="viewConfirm", path="viewConfirm.do") - }, - [EMAIL PROTECTED](name="failure", navigateTo=Jpf.NavigateTo.currentPage) - ) - protected Forward order(CheckoutForm checkoutForm) - { - _sharedFlow.ensureLogin(); - if(checkoutForm.isShippingAddressRequired()) - return new Forward("viewShipping", checkoutForm); - else return new Forward("viewConfirm"); - } + return lineItems; + } } Modified: incubator/beehive/trunk/samples/petstoreWeb/checkout/confirm.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/checkout/confirm.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/checkout/confirm.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/checkout/confirm.jsp Tue Apr 12 16:13:55 2005 @@ -4,33 +4,25 @@ <%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib prefix="beehive-petstore" tagdir="/WEB-INF/tags/beehive/petstore" %> -<netui-data:declarePageInput name="checkout" type="java.lang.Boolean"/> -<netui-data:declarePageInput name="order" type="org.apache.beehive.samples.petstore.model.Order"/> <netui-template:template templatePage="/site/template.jsp"> - <netui-template:section name="leftnav"> - <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> - <beehive-petstore:catalogNav action="rootSharedFlow.globalShop" labelValue="${bundle.view.mainMenuLabel}"/> - </netui-template:section> +<!-- Turn off the header menu --> +<style> +#main_menu {visibility: hidden;} +</style> <netui-template:section name="body"> <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> - - <netui-data:getData resultId="checkout" value="${pageInput.checkout}"/> - - <netui:errors/><p> - - <br clear="all"/> - <p> <center> <netui:span styleClass="boldlabel" value="${bundle.view.confirmMessage}"/> </center> <p> - <beehive-petstore:orderSummary order="${pageInput.order}"/> + <beehive-petstore:orderSummary /> <p> <center> - <netui:imageAnchor action="confirm" border="0" src="${pageContext.request.contextPath}/images/button_continue.gif"> - <netui:parameter name="confirmed" value="true"/> - </netui:imageAnchor> + + <netui:imageAnchor action="viewCreateOrder" border="0" src="${pageContext.request.contextPath}/images/button_previous.gif" /> + + <netui:imageAnchor action="confirm" border="0" src="${pageContext.request.contextPath}/images/button_continue.gif" /> </center> </netui-template:section> </netui-template:template> Modified: incubator/beehive/trunk/samples/petstoreWeb/checkout/newOrder.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/checkout/newOrder.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/checkout/newOrder.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/checkout/newOrder.jsp Tue Apr 12 16:13:55 2005 @@ -2,22 +2,23 @@ <%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0" prefix="netui-data"%> <%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%> <%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%> -<netui-data:declarePageInput name="order" type="org.apache.beehive.samples.petstore.model.Order"/> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <netui-data:declarePageInput name="creditCardTypes" type="java.util.List"/> - - - +<netui-data:declarePageInput name="addresses" type="org.apache.beehive.samples.petstore.model.Addresses"/> <netui-template:template templatePage="/site/template.jsp"> - - <netui-template:section name="leftnav"> </netui-template:section> +<!-- Turn off the header menu --> +<style> +#main_menu {visibility: hidden;} +</style> <netui-template:section name="body"> <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> - <netui:form action="order"> + <netui:span styleClass="boldlabel" value="${bundle.view.checkoutStep1}"/> + <netui:form action="viewConfirm"> <center> - <table border=0 cellpadding=3 cellspacing=1 bgcolor=#FFFF88> + <table border=0 cellpadding=1 cellspacing=1 bgcolor=#FFFF88> <tr bgcolor=#FFFF88> <td colspan=2> <font color=green size=4><B>${bundle.view.paymentDetailsLabel}</B></font> @@ -35,101 +36,71 @@ </td> <td> <netui:textBox dataSource="actionForm.order.creditCard"/> - <br/> <netui:error key="creditCard"/> - <font color=red size=2>Note, be sure to use an invalid number.</font></td> + <br/> + <font color=red size=2>Note: be sure to use an invalid number.</font></td> </tr> <tr bgcolor=#FFFF88> <td>${bundle.view.expirationDateLabel}: </td> <td> <netui:textBox dataSource="actionForm.order.exprDate"/> + <netui:error key="expirationDate"/> </td> </tr> <tr bgcolor=#FFFF88> - <td colspan=2><font color=green size=4><B>${bundle.view.billingAddressLabel}</B></font></td> - </tr> - <tr bgcolor=#FFFF88> - <td>${bundle.view.firstNameLabel}: - </td> - <td> - <netui:textBox size="40" dataSource="actionForm.order.billingAddress.firstName"/> - <br/> - <netui:error key="billToFirstName"/> - </td> - </tr> - <tr bgcolor=#FFFF88> - <td>${bundle.view.lastNameLabel}: - </td> - <td> - <netui:textBox size="40" dataSource="actionForm.order.billingAddress.lastName"/> - <br/> - <netui:error key="billToLastName"/> - </td> - </tr> - <tr bgcolor=#FFFF88> - <td>${bundle.view.address1Label}: - </td> - <td> - <netui:textBox size="40" dataSource="actionForm.order.billingAddress.addr1"/> - <br/> - <netui:error key="billToAddress1"/> - </td> - </tr> - <tr bgcolor=#FFFF88> - <td>${bundle.view.address2Label}: - </td> - <td> - <netui:textBox size="40" dataSource="actionForm.order.billingAddress.addr2"/> - <br/> - <netui:error key="billToAddress2"/> - </td> - </tr> - <tr bgcolor=#FFFF88> - <td>${bundle.view.cityLabel}: - </td> - <td> - <netui:textBox size="20" dataSource="actionForm.order.billingAddress.city"/> - <br/> - <netui:error key="billToCity"/> - </td> - </tr> - <tr bgcolor=#FFFF88> - <td>${bundle.view.stateLabel}: - </td> - <td> - <netui:textBox size="4" dataSource="actionForm.order.billingAddress.state"/> - <br/> - <netui:error key="billToState"/> - </td> - </tr> - <tr bgcolor=#FFFF88> - <td>${bundle.view.zipLabel}: - </td> - <td> - <netui:textBox size="10" dataSource="actionForm.order.billingAddress.zip"/> - <br/> - <netui:error key="billToZip"/> - </td> - </tr> - <tr bgcolor=#FFFF88> - <td>${bundle.view.countryLabel}: - </td> - <td> - <netui:textBox size="15" dataSource="actionForm.order.billingAddress.country"/> - <br/> - <netui:error key="billToCountry"/> - </td> - </tr> - <tr bgcolor=#FFFF88> - <td colspan=2> - <netui:checkBox dataSource="actionForm.shippingAddressRequired"/> - ${bundle.view.shipToDifferentAddressMessage} - </td> + <td colspan=2><br/><font color=green size=4><B>${bundle.view.billingAddressLabel}</B></font> - <netui:anchor action="rootSharedFlow.globalViewAddresses.do">Create New</netui:anchor></td> </tr> + <tr bgcolor=#FFFF88> + <td colspan=2><netui:radioButtonGroup dataSource="actionForm.order.billingAddress"> + <table cellspacing="10" cellpadding="10"><tr> + <netui-data:repeater dataSource="pageInput.addresses"> + <td class="cellgrey" valign="top"><netui:radioButtonOption value="${container.item.addressId}">${container.item.name}</netui:radioButtonOption><br/> + <netui:span value="${container.item.addr1}" /> + <c:if test="${container.item.addr2 != ''}"> + <br/> + </c:if> + <netui:span value="${container.item.addr2}" /><br/> + <netui:span value="${container.item.city}" />, + <netui:span value="${container.item.state}" /> + <netui:span value="${container.item.zip}" /><br/> + <netui:span value="${container.item.country}" /><br/> + <netui:span value="${container.item.phone}" /> + </td> + </netui-data:repeater> + </tr></table> + </netui:radioButtonGroup> + <netui:error key="billingAddress"/> + </td> + </tr> + <tr bgcolor=#FFFF88> + <td colspan=2><br/><font color=green size=4><B>${bundle.view.shippingAddressLabel}</B></font> - <netui:anchor action="rootSharedFlow.globalViewAddresses.do">Create New</netui:anchor></td> + </tr> + <tr bgcolor=#FFFF88> + <td colspan=2><netui:radioButtonGroup dataSource="actionForm.order.shippingAddress"> + <table cellspacing="10" cellpadding="10"><tr> + <netui-data:repeater dataSource="pageInput.addresses"> + <td class="cellgrey" valign="top"><netui:radioButtonOption value="${container.item.addressId}">${container.item.name}</netui:radioButtonOption><br/> + <netui:span value="${container.item.addr1}" /> + <c:if test="${container.item.addr2 != ''}"> + <br/> + </c:if> + <netui:span value="${container.item.addr2}" /><br/> + <netui:span value="${container.item.city}" />, + <netui:span value="${container.item.state}" /> + <netui:span value="${container.item.zip}" /><br/> + <netui:span value="${container.item.country}" /><br/> + <netui:span value="${container.item.phone}" /> + </td> + </netui-data:repeater> + </tr></table> + </netui:radioButtonGroup> + <netui:error key="shippingAddress"/> + </td> + </tr> </table> <p/> - <netui:imageButton align="center" src="${pageContext.request.contextPath}/images/button_submit.gif"/> + <netui:imageButton align="center" src="${pageContext.request.contextPath}/images/button_continue.gif"/> </center> </netui:form> </netui-template:section> Modified: incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/checkout/viewCart.jsp Tue Apr 12 16:13:55 2005 @@ -4,16 +4,16 @@ <%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%> <%@ taglib prefix="beehive-petstore" tagdir="/WEB-INF/tags/beehive/petstore" %> +<!-- Turn off the header menu --> +<style> +#main_menu {visibility: hidden;} +</style> + <netui-template:template templatePage="/site/template.jsp"> - <netui-template:section name="leftnav"> - <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> - <beehive-petstore:catalogNav action="rootSharedFlow.globalViewCart" labelValue="${bundle.view.shoppingCartLabel}"/> - </netui-template:section> <netui-template:section name="body"> <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> - <netui:errors/> <center> <netui:span styleClass="boldlabel" value="${bundle.view.checkoutSummaryLabel}"/> <br/> @@ -42,11 +42,7 @@ </td> <td class="celldata"> <netui:span value="${container.item.item.attr1}"/> - <netui:span value="${container.item.item.attr2}"/> - <netui:span value="${container.item.item.attr3}"/> - <netui:span value="${container.item.item.attr4}"/> - <netui:span value="${container.item.item.attr5}"/> - <netui:span value="${container.item.item.product.name}"/> + <netui:span value="${container.item.item.productName}"/> </td> <td align="center"> <netui:span value="${container.item.inStock}"/> @@ -75,6 +71,6 @@ </tr> </table> <br/> - <netui:imageAnchor action="viewCreateOrder" border="0" src="${pageContext.request.contextPath}/images/button_continue.gif"/> + <netui:imageAnchor action="createNewOrder" border="0" src="${pageContext.request.contextPath}/images/button_continue.gif"/> </center> </netui-template:section> </netui-template:template> Modified: incubator/beehive/trunk/samples/petstoreWeb/checkout/viewOrder.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/checkout/viewOrder.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/checkout/viewOrder.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/checkout/viewOrder.jsp Tue Apr 12 16:13:55 2005 @@ -6,24 +6,23 @@ <%@ taglib prefix="beehive-petstore" tagdir="/WEB-INF/tags/beehive/petstore" %> <netui-data:declarePageInput name="order" type="org.apache.beehive.samples.petstore.model.Order"/> -<netui-data:declarePageInput name="checkout" type="java.lang.Boolean"/> +<netui-data:declarePageInput name="lineItems" type="org.apache.beehive.samples.petstore.model.LineItem[]"/> +<netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> <netui-template:template templatePage="/site/template.jsp"> <netui-template:section name="leftnav"> - <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> <beehive-petstore:catalogNav action="rootSharedFlow.globalShop" labelValue="${bundle.view.mainMenuLabel}"/> </netui-template:section> <netui-template:section name="body"> - <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> + <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.account" name="account"/> <br/> - <br/> - <c:if test="${pageInput.checkout != null}"> + <c:if test="${pageInput.order.status == 'new'}"> <center> <b>${bundle.view.orderSubmittedMessage}</b> </center> </c:if> <br/> - <br/> - <beehive-petstore:orderSummary order="${pageInput.order}"/> + <beehive-petstore:orderSummary/><p/> + <netui:anchor action="viewOrders"><b>${bundle.account.listOrdersLabel}</b></netui:anchor> </netui-template:section> </netui-template:template> Modified: incubator/beehive/trunk/samples/petstoreWeb/error.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/error.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/error.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/error.jsp Tue Apr 12 16:13:55 2005 @@ -61,7 +61,7 @@ </c:if> <tr><th>Exception:</th><td class="pfErrorLineOne"><netui:exceptions showMessage="true"/></td></tr> <tr><td colspan="2" style="min-width:342"><hr></td></tr> - <tr><th>Stack Trace:</th><td><netui:exceptions showMessage="false" showDevModeStackTrace="true"/></td></tr> + <tr><th>Stack Trace:</th><td><netui:exceptions showMessage="false" showStackTrace="true"/></td></tr> </table> </netui:body> </netui:html> Modified: incubator/beehive/trunk/samples/petstoreWeb/index.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/index.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/index.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/index.jsp Tue Apr 12 16:13:55 2005 @@ -3,9 +3,9 @@ <%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" prefix="netui"%> <%@ taglib uri="http://beehive.apache.org/netui/tags-template-1.0" prefix="netui-template"%> <%@ taglib prefix="beehive-petstore" tagdir="/WEB-INF/tags/beehive/petstore" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <netui-data:declareBundle bundlePath="org.apache.beehive.samples.petstore.resources.view" name="view"/> - <netui:html> <head> <title> @@ -27,7 +27,13 @@ <netui:anchor href="shop/Controller.jpf"> ${bundle.view.enterTheStore} </netui:anchor> - </p> + <br/><br/> + <c:if test="${pageContext.request.serverName == 'localhost'}"> + <b>${bundle.view.adminTitle}</b><br> + <netui:anchor action="initDB">${bundle.view.adminInit}</netui:anchor><br/> + <netui:anchor action="stopDB">${bundle.view.adminStop}</netui:anchor><br/> + <netui:label value="${requestScope.message}" /> + </c:if> </td> </tr> </tbody> Modified: incubator/beehive/trunk/samples/petstoreWeb/search/Controller.jpf URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/search/Controller.jpf?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/search/Controller.jpf (original) +++ incubator/beehive/trunk/samples/petstoreWeb/search/Controller.jpf Tue Apr 12 16:13:55 2005 @@ -24,6 +24,7 @@ import org.apache.beehive.samples.petstore.forms.SearchForm; import org.apache.beehive.samples.petstore.model.Product; import org.apache.beehive.samples.petstore.controls.CatalogControl; +import org.apache.beehive.samples.petstore.controls.exceptions.DataStoreException; import org.apache.beehive.controls.api.bean.Control; @Jpf.Controller( @@ -51,7 +52,7 @@ }) } ) - protected Forward begin(SearchForm form) { + protected Forward begin(SearchForm form) throws DataStoreException { Product[] searchResults = _catalogControl.searchProductList(form.getKeyword()); return new Forward("success", "searchResults", searchResults); Modified: incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf (original) +++ incubator/beehive/trunk/samples/petstoreWeb/shop/Controller.jpf Tue Apr 12 16:13:55 2005 @@ -17,6 +17,7 @@ */ package shop; + import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -26,6 +27,8 @@ import org.apache.beehive.netui.pageflow.annotations.Jpf; import org.apache.beehive.samples.petstore.controls.CatalogControl; +import org.apache.beehive.samples.petstore.controls.exceptions.DataStoreException; +import org.apache.beehive.samples.petstore.controls.exceptions.InvalidIdentifierException; import org.apache.beehive.samples.petstore.model.Cart; import org.apache.beehive.samples.petstore.model.Category; import org.apache.beehive.samples.petstore.model.Item; @@ -82,7 +85,7 @@ }) } ) - protected Forward begin() { + protected Forward begin() throws DataStoreException { if(_categories == null) _categories = _catalogControl.getCategoryList(); @@ -102,7 +105,7 @@ }) } ) - protected Forward viewCategory() { + protected Forward viewCategory() throws InvalidIdentifierException, DataStoreException { String categoryId = getRequest().getParameter("catId"); if(categoryId == null || categoryId.equals("")) @@ -130,7 +133,7 @@ }) } ) - protected Forward viewProduct() { + protected Forward viewProduct() throws InvalidIdentifierException, DataStoreException { String productId = getRequest().getParameter("productId"); if(productId == null || productId.equals("")) @@ -158,7 +161,7 @@ }) } ) - protected Forward viewItem() { + protected Forward viewItem() throws InvalidIdentifierException, DataStoreException { String itemId = getRequest().getParameter("itemId"); if(itemId == null || itemId.equals("")) @@ -184,7 +187,7 @@ }), @Jpf.Forward(name="cart", path="cart.jsp") }) - protected Forward addItemToCart(CartForm form) { + protected Forward addItemToCart(CartForm form) throws InvalidIdentifierException, DataStoreException { Cart cart = form.getCart(); if (cart.containsItemId(form.getWorkingItemId())) { @@ -195,7 +198,7 @@ Item toAddItem = _catalogControl.getItem(form.getWorkingItemId()); if (toAddItem != null) { - toAddItem.setProduct(_currentProduct); + //toAddItem.setProduct(_currentProduct); cart.addItem(toAddItem); } /* todo: error handling path */ Modified: incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/shop/cart.jsp Tue Apr 12 16:13:55 2005 @@ -14,7 +14,7 @@ <br/> <c:choose> <c:when test="${sharedFlow.rootSharedFlow.account != null}"> - <c:if test="${sharedFlow.rootSharedFlow.account.myListOpt != null}"> + <c:if test="${sharedFlow.rootSharedFlow.account.myListOpt == true}"> <beehive-petstore:productFavorites/> </c:if> </c:when> @@ -56,11 +56,7 @@ <td class="celldata"><netui:span value="${container.item.item.productId}"/></td> <td class="celldata"> <netui:span value="${container.item.item.attr1}"/> - <netui:span value="${container.item.item.attr2}"/> - <netui:span value="${container.item.item.attr3}"/> - <netui:span value="${container.item.item.attr4}"/> - <netui:span value="${container.item.item.attr5}"/> - <netui:span value="${container.item.item.product.name}"/> + <netui:span value="${container.item.item.productName}"/> </td> <td class="celldata"> <netui:span value="${container.item.inStock}"/> Modified: incubator/beehive/trunk/samples/petstoreWeb/shop/item.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/shop/item.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/shop/item.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/shop/item.jsp Tue Apr 12 16:13:55 2005 @@ -33,10 +33,6 @@ <td class="celldata"> <span class="boldlabel"> <netui:span value="${pageInput.item.attr1}"/> - <netui:span value="${pageInput.item.attr2}"/> - <netui:span value="${pageInput.item.attr3}"/> - <netui:span value="${pageInput.item.attr4}"/> - <netui:span value="${pageInput.item.attr5}"/> <netui:span value="${pageInput.product.name}"/> </span> </td> Modified: incubator/beehive/trunk/samples/petstoreWeb/shop/product.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/shop/product.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/shop/product.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/shop/product.jsp Tue Apr 12 16:13:55 2005 @@ -44,10 +44,6 @@ <td class="celldata"><netui:span value="${container.item.productId}"/></td> <td class="celldata"> <netui:span value="${container.item.attr1}"/> - <netui:span value="${container.item.attr2}"/> - <netui:span value="${container.item.attr3}"/> - <netui:span value="${container.item.attr4}"/> - <netui:span value="${container.item.attr5}"/> <netui:span value="${pageInput.product.name}"/> </td> <td class="celldata"> Modified: incubator/beehive/trunk/samples/petstoreWeb/site/template.jsp URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/site/template.jsp?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/site/template.jsp (original) +++ incubator/beehive/trunk/samples/petstoreWeb/site/template.jsp Tue Apr 12 16:13:55 2005 @@ -15,7 +15,7 @@ <link rel="stylesheet" href="${pageContext.request.contextPath}/site/default.css" type="text/css"/> </head> <netui:body> - <beehive-petstore:headerMenu contextPath="${pageContext.request.contextPath}"/> + <beehive-petstore:headerMenu contextPath="${pageContext.request.contextPath}" /> <br/> <div> <%-- Include the template's "leftnav" section --%> @@ -26,8 +26,10 @@ </div> <%-- Include the template's "body" section --%> <div id="main"> - <beehive-petstore:categoryNavHeader contextPath="${pageContext.request.contextPath}"/> - <br/> + <div id="main_menu"> + <beehive-petstore:categoryNavHeader contextPath="${pageContext.request.contextPath}"/> + <br/> + </div> <netui-template:includeSection name="body"/> </div> <div id="footer"> Modified: incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs?view=diff&r1=161135&r2=161136 ============================================================================== --- incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs (original) +++ incubator/beehive/trunk/samples/petstoreWeb/webappRoot/SharedFlow.jpfs Tue Apr 12 16:13:55 2005 @@ -32,6 +32,7 @@ import org.apache.beehive.samples.petstore.model.Product; import org.apache.beehive.samples.petstore.controls.AccountControl; import org.apache.beehive.samples.petstore.controls.CatalogControl; +import org.apache.beehive.samples.petstore.controls.exceptions.DataStoreException; import org.apache.beehive.samples.petstore.controls.exceptions.NoSuchAccountException; import org.apache.beehive.samples.petstore.controls.exceptions.InvalidIdentifierException; @@ -48,7 +49,9 @@ @Jpf.SimpleAction(name="globalViewCategory", path="/shop/viewCategory.do"), @Jpf.SimpleAction(name="globalEditAccount", path="/account/edit/viewUpdateAccount.do"), @Jpf.SimpleAction(name="globalViewProductById", path="/shop/viewProduct.do"), - @Jpf.SimpleAction(name="globalViewCreateAccount", path="/account/create/Controller.jpf") + @Jpf.SimpleAction(name="globalViewAddresses", path="/account/addresses/begin.do"), + @Jpf.SimpleAction(name="globalViewCreateAccount", path="/account/create/Controller.jpf"), + @Jpf.SimpleAction(name="globalCheckOut", path="/checkout/createNewOrder.do") } ) public class SharedFlow @@ -66,8 +69,9 @@ private Cart _cart = null; private Product[] _myList; - protected void onCreate() { - // todo: move to ServletContext so it's cached for all users + protected void onCreate() throws DataStoreException { + + // todo: move to ServletContext so it's cached for all users Category[] categories = _catalogControl.getCategoryList(); CATEGORY_NAMES = new String[categories.length]; for(int i = 0; i < CATEGORY_NAMES.length; i++) @@ -86,12 +90,12 @@ throw new NotLoggedInException("User not logged in", this); } - public void handleLogin(String username) { + public void handleLogin(String username) throws DataStoreException, NoSuchAccountException, InvalidIdentifierException { Account account = _accountControl.getAccount(username); - /* @todo: need to fix the case where the account isn't found for this username */ + // Throw an exception if the user is not found if(account == null) - return; + throw new NoSuchAccountException("Unknown user: " + username); // and set the account (this toggles the user's logged in status) setAccount(account); @@ -110,11 +114,12 @@ } public void handleCheckout() { + _account.setStatus("OK"); setCart(null); } public void updateAccount(Account account) - throws InvalidIdentifierException, NoSuchAccountException { + throws InvalidIdentifierException, NoSuchAccountException, DataStoreException { // update account info in globalApp _account = account;
