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.

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 6 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
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
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 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.  
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
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 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
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 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
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
How to add dynamic table in java
How to add dynamic table in java  How to add dynamic table in java   import java.awt.*; import java.sql.*; import java.util.*; import javax.swing.*; import java.awt.event.*; import javax.swing.table.*; public class
Create Radio Buttons in SWT
Create Radio Buttons in SWT       This section illustrates you how to create radio button. In SWT, the style RADIO defined in the Button class allows to create radio button. We
How to refresh a jTable On adding or deleting record ....
How to refresh a jTable On adding or deleting record ....   Hii Sir, I am developing a project in which a jtable is getting populated from database and displayed in panel... Now i have to add records in the database
how update JTable after adding a row into database
how update JTable after adding a row into database  J have two... in JTable, and it's OK, but after adding a row into database table does't update. How update JTable after adding a row into database? package djile pak.java
Free Java Shopping Cart,Shopping cart Application
shop shopping cart that is used by the customer in selecting certain products... Free Java Shopping Cart       Shopping Cart allows the web site owner to setup online store so that visitors can
Buttons with Icons
Java: Buttons with Icons You can create buttons that show text, icons (images), or both.   In this example you will learn how to create Buttons... to use ImageIcons for buttons.   To create a button with an icon  
i need project for shopping cart in struts 1 with the oracle database and give clear explanation for how to execute it in my eclipse
i need project for shopping cart in struts 1 with the oracle database and give clear explanation for how to execute it in my eclipse  i need a project for shopping cart in struts1 with the oracle database and give clear
how to store dynamic array in hidden field in javascript?
how to store dynamic array in hidden field in javascript?  I have created array of textboxes dynamically in html using javascript. i just want... in how to store it in hidden field
Shopping Cart
Shopping Cart  Give some same code for shopping cart.. once click "Add to cart button" add item into cart and also moved into next step
Shopping Cart
Shopping Cart Shopping cart is also know as trolley, carriage, buggy or wagon is a cart mostly used while shopping in shopping mall. These cart is provided.... On the web shopping portal you can search the products and then add
how to store a dynamic values - JSP-Servlet
how to store a dynamic values  Dear sir, i have a ArrayList in that i have stored a values from a excel sheet specified column values and i have one string that is as follows Dear ~2 , Your cl is ~3 ,el is ~4
Features of shopping cart
Features of shopping cart In this section we will learn the features of good shopping cart applications. There are shopping cart application on the Internet... on requirement and you can select best shopping cart application for your shopping
shopping cart
shopping cart  hi i want the sample project for shopping cart in struts with mysql ,if any one knows means please help me
add to cart
add to cart  sir, i want to do add to cart to my shopping application each user using sessions. Plz help thnaks in advance
How can I Define a JFrame subclass that has four vertically positioned buttons. - Java Beginners
How can I Define a JFrame subclass that has four vertically positioned buttons.  How can I Define a JFrame subclass that has four vertically.../create_multiple_buttons_using_ja.shtml Thanks
VoIP Products
VOIP Products offered by the leaders in this field, how well they handle... VoIP Products          VoIP Products and Services Once you are aware of the benefits
Maximize Sales By Setting up Your Shopping Cart
by selling your products at a higher margin. There are many shopping cart solutions... products to your shopping cart or even you can use the auto option. You have... products to your shopping cart. Sometimes, if you sell one product under
how to done calculation for dynamic generated textboxes in jquery/javascript/ajax?
how to done calculation for dynamic generated textboxes in jquery/javascript/ajax?  how to done calculation for dynamic generated textboxes in jquery/javascript/ajax
 

 

 

DMCA.com