Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSF-Questions How to create dynamic buttons for adding products on a cart.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


william maidl granzotto
How to create dynamic buttons for adding products on a cart.
0 Answer(s)      2 years and 9 months ago
Posted in : Java Server Faces Questions


Hi. I have some problems creating a page to add items into a cart. The page loads dynamic products from a database, and i would like to know how to group this products so that when i click a button, my CartBean gets updated by that product clicked.

here, my xhtml page.

<h:body style=" background-color: #eeeeee">
    <div id="content" align="center">
        <!-- Division containing the top content-->
        <div id="top">
            <table width="70%">
                <tr valign="center">
                    <td align="left">
                        <c:if test="${login.login}">
                            Bem vindo <b>${login.name}</b>, boas compras.
                        </c:if>
                    </td>
                </tr>
                <tr>
                    <td>
                        <h:form>
                            <h:commandButton value="LOGO"/>
                            <h:inputText id="searchTxt" size="50" value="#{searchEngine.searchWord}"/>
                            <h:commandLink id="searchBtn" action="buscar" actionListener="#{searchEngine.searchMethod}">
                                <h:graphicImage url="resources/lupa1.jpg" style=" vertical-align: bottom"/>
                            </h:commandLink> 
                            &nbsp;
                            <h:commandLink value="Sobre Nós" action="index"/>
                            &nbsp;|&nbsp;
                            <h:commandLink value="Fale Conosco" action="contato"/>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <h:commandLink value="Criar Conta" action="cadastro"/>
                            &nbsp;|&nbsp;
                            <h:commandLink value="Login" action="login"/>
                        </h:form>
                    </td>
                </tr>
            </table>
        </div>
        <!-- Division containing the main table -->
        <div id="table">
            <table width="70%">
                <tr>
                    <td bgcolor="#999999" style="width:20%">
                        <h1><font color="#cccccc">Categorias de Produtos do Site</font></h1>
                    </td>
                    <td bgcolor="#333333" style="width:60%; vertical-align: bottom">
                        <font color="#ffffff">
                            Resultados da busca por '${searchEngine.lastSearch}'</font>
                    </td>
                    <td bgcolor="#eeeeee" style="width:20%">
                        The right side
                    </td>
                </tr>
                <tr>
                    <td valign="top" bgcolor="#333333">
                        <div id="demo">
                            <p><a href="#" class="eletronicos">Eletrônicos</a></p>
                            <p><a href="#" class="cameras-filmadoras">Câmeras e Filmadoras</a></p>
                            <p><a href="#" class="celulares">Celulares</a></p>
                            <p><a href="#" class="informatica">Informática</a></p>
                            <p><a href="#" class="perfumaria">Perfumaria</a></p>
                        </div>
                    </td>
                    <td bgcolor="#ffffff" valign="top">
                        <p>A busca pelo termo '${searchEngine.lastSearch}' retornou a seguinte relação de produtos, em ordem alfabética:</p>
                        <c:forEach items="${searchEngine.products}" var="product">
                            <table align="center" width="95%">
                                <tr bgcolor="#eeeeee">
                                    <th colspan="2" align="left"><b>${product.name}</b></th>
                                </tr>
                                <tr>
                                    <td width="35%">
                                        <h:graphicImage url="products/${product.url}"/>
                                    </td>
                                    <td width="65%">
                                        <p><font color="#DD0000" size="3">R$ ${product.inCash} à vista</font></p>
                                        <p><font color="#DD0000" size="5">${product.instalments} X <font size="7">${product.paymentDeadline}</font></font>
                                            <h:form>
                                                <h:commandButton action="#{carrinho.add(product.name)}" value="adicionar"/>
                                            </h:form>
                                        </p>
                                    </td>
                                </tr>
                            </table>
                        </c:forEach>


                    </td>
                    <td bgcolor="#ffffff" valign="top">
                        Caso não encontre os produtos desejádos, mande-nos um e-mail e entraremos em contato.
                    </td>
                </tr>
            </table>
        </div>
        <div id="bottom">
            <table>
                <tr>
                    <td>
                        <p>Logo Inferior</p>
                        <p><font size="2">&copy; 2012 Loja de Importados</font></p>
                    </td>
                    <td>
                        <h:form>
                            <h:commandLink value="Sobre Nós" action="contato"/>
                            &nbsp;|&nbsp;
                            <h:commandLink value="Fale Conosco" action="contato"/>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <h:commandLink value="Criar Conta" action="cadastro"/>
                            &nbsp;|&nbsp;
                            <h:commandLink value="Login" action="login"/>
                        </h:form>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</h:body>;

Advertisement
View Answers

Related Tutorials/Questions & Answers:
How to create dynamic buttons for adding products on a cart.
How to create dynamic buttons for adding products on a cart.  Hi. I have some problems creating a page to add items into a cart. The page loads dynamic products from a database, and i would like to know how to group this products
How to prevent adding duplicate items to the shopping cart
How to prevent adding duplicate items to the shopping cart  ...;?php session_start(); if (!isset($_SESSION['SHOPPING_CART'])){ $_SESSION['SHOPPING_CART'] = array(); } if (isset($_GET['itemID']) && isset($_GET
Advertisements
Shopping Cart Products
Know To Sell The Right Products On E-Commerce Shopping Cart E-commerce... to be wary of your competitors who are selling the same products too. How... as this is the fastest way of shopping and shipping products to customers. Many online
How to create dynamic array in C?
How to create dynamic array in C?  How to create dynamic array in c programming language?   Dynamic Array in C Tutorial
How to Create Dynamic URLs in PHP?
How to Create Dynamic URLs in PHP?  How to Create Dynamic URLs in PHP
adding buttons - Swing AWT
adding buttons  can u plzz explain how to add button to a dialog box and make them perform some event on the image loaded on the panel
adding buttons - Swing AWT
adding buttons  can u plzz explain how to add button to a dialog box and make them perform some event on the image loaded on the panel
creating dynamic buttons in iphone
creating dynamic buttons in iphone  i Have a UIView and i wanted to create a multiple buttons to that should come on view load. It will be great if that can be removed after sometime or required time.   -(void
To create a shopping cart
To create a shopping cart  I want to create a online shopping cart..., how to retrieve the data from the database by creating a single table for different products as mentioned above. Hope someone will help me out. thnx
how to create directed line between two buttons when i clicked there
how to create directed line between two buttons when i clicked there  Hi I have to create a topology between 6 nodes. 6 nodes are created as 6 buttons and when i clicked in first button and then on second button a directed
how to create a dynamic website - Servlet Interview Questions
how to create a dynamic website  create a dynamic website of a topic of your choice. Web technologies to be used should include: HTML, JavaScript, Applets, Serverlets, and Database.  Hi friend, employee form
create dynamic array in javascript
create dynamic array in javascript  How to create dynamic array in javascript
Create Multiple Buttons
Create Multiple Buttons using Java Swing       In this section, you will learn how to create multiple buttons labeled with the letters from A to Z respectively. To display them, we
create dynamic image gallery jquery
create dynamic image gallery jquery  How to create a dynamic image gallery in Jquery
Create dynamic page through JSP
how to create dynamic page. This code shows one by one record of student from... Create dynamic page through JSP..., application fetch next record from database. Create a database :  Before
How to Create Animated Main Menu Application with Java Swnig Buttons - Java Beginners
How to Create Animated Main Menu Application with Java Swnig Buttons  Hello sir I want to display Main Menu after Log in i have created Log in Form but I want More attractive Animated Main Menu which includes Following
Create Dynamic Table using Hubernate
Create Dynamic Table using Hubernate  Thank's for reading my Post. I...: How to create seperate table for all users they sign up for my web app. i need... files but i done create and update for a single table. i dono how to automate
how to add dynamic data
how to add dynamic data  how to add dynamic data to an existing web application
Shopping cart
Shopping cart Overview A web based shopping cart is something like the original grocery shop shopping cart that is used by the customer in selecting certain products. Finally after selection the customer confirms orders
Shopping Cart
Shopping Cart In this section we will discuss about shopping cart and how you... of the easiest way to sale products, you have to setup shopping cart application, add your... the shopping cart, we will also see how to setup a shopping cart website for selling
What is shopping cart?
and much more. How a shopping cart works? A shopping cart software is dynamic web... shopping cart software for selling their products online. What is shopping...? AAdmin panel provides the UI for managing the shopping cart products, price
How can combine threads and buttons?
How can combine threads and buttons?  I would like to start an application, stop it and restart it again and stop etc. I tried the following code... TestActionEvent(); frame.setTitle("Two buttons
how to upload and download images using buttons in jsp?
how to upload and download images using buttons in jsp?  how to upload and download images using buttons in jsp
i want to create dynamic calendar in java
i want to create dynamic calendar in java  i want code and explanation
i want to create dynamic calendar in java
i want to create dynamic calendar in java  i want code and explanation
Choosing the Best Ecommerce Shopping Cart
Choosing the Best Ecommerce Shopping Cart In this articles explains you how to choose the best ecommerce shopping cart for your next online shopping portal...-friendly shopping cart software for selling the products online.  
Buttons
Buttons  I have created a web page with radio button group with two radio buttons for accepting the home appliances categories,Kitchen appliances and other appliances.I want to check for the appliance chosen when the required
how to write a query for adding records in database
how to write a query for adding records in database  How write fire query in JSP for adding records in database
how to display a table and buttons in swings - Java Beginners
how to display a table and buttons in swings  Hi frends, Actually... different buttons below this displayed table using swings.....please can any... the table and iam not getting buttons below the table......... Thanking you
how to insert value in dynamic table
how to insert value in dynamic table  i am creating a project in Training and Placement.i have a created a company register part where i create a dynamic table for every company.but whenever i'm inserting values to the company
Shopping Cart design
need is for general shopping cart application then we will create design for your site and use open source shopping cart of your choice to create online...Shopping Cart design We provide Shopping Cart designing, development
 

 

 

DMCA.com