Announcement Announcement Module
No announcement yet.
Implementation of a SKU drop down on a Item detail page Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Implementation of a SKU drop down on a Item detail page

    Hi all,

    I am trying to implement a drop down functionality for an item detail page for a web site.
    However, I am having difficulties getting both the item attribute and
    the sku details. I have a form that will populate the sku info and submit them.
    At the same time, I want to display the item price , item description and so forth on the same page.
    I am using the simpleformController but I'm trying to implement both the handleRequest() method and the onSubmit() method.

    Is that doable?

    Thanks in advance you for your reply.

  • #2
    If you are trying to show the detail of an item and also look it up on the same page, yes it can be done. If this is not what you meant can you elaborate more on your problem?


    • #3
      Hi Maverick,

      Yes, what i'm trying to do is to show the item detail and also have the possibility to pick the item sku from a drop down and show them in my shopping cart on a left nav like most ecommerce sites do.

      I will greatly appreciate if you can show me how to do that.



      • #4
        I would do something like this.

        In the SimpleFormController subclass

        override the referenceData method as follows

        Map<String, Object> referenceDataMap = new HashMap<String, Object>();
                referenceDataMap.put("itemSkuList", itemSkuList);
                return referenceDataMap;
        bean definition would be something like this for the command assuming sku is a property in Item object

        <bean id="someController" class="pathToYourControllerClass">
        	<property name="commandClass" value="com.??.Item"/>
        override onSubmit(Object command) method as

        ModelAndView modelAndView = super.onSubmit(command);
        Item item = (Item) command;
        modelAndView.getModel().put("item", retrieveItem(item.getSku()));
        return modelAndView;
        And your jsp would be something like this

        <form:select path="sku">
        	<form:options items="${requestScope.itemSkuList}"/> <!-- Matches what you populated into model -->
        <input type="submit" ..../>
        <c:if test="${!empty requestScope.item}"> <!-- Matches what you populated into model -->
        	// display your item here
        Last edited by maverickthinker; Aug 20th, 2008, 12:48 PM. Reason: more notes


        • #5
          Thank you very much. I will try this and let you know how it goes.