Package util

Examples of util.Currency


        if (bookId != null) {
            // and the information about the book
            try {
                Book bd = bookDB.getBook(bookId);
                Currency c = (Currency) session.getAttribute("currency");

                if (c == null) {
                    c = new Currency();
                    c.setLocale(request.getLocale());
                    session.setAttribute("currency", c);
                }

                c.setAmount(bd.getPrice());

                //Print out the information obtained
                out.println(
                        "<h2>" + bd.getTitle() + "</h2>" + "&nbsp;"
                        + messages.getString("By") + " <em>"
                        + bd.getFirstName() + " " + bd.getSurname()
                        + "</em> &nbsp; &nbsp; " + "(" + bd.getCalendar_year()
                        + ")<br> &nbsp; <br>" + "<h4>"
                        + messages.getString("Critics") + "</h4>"
                        + "<blockquote>" + bd.getDescription()
                        + "</blockquote>" + "<h4>"
                        + messages.getString("Price") + c.getFormat() + "</h4>"
                        + "<p><strong><a href=\""
                        + response.encodeURL(
                                request.getContextPath()
                                + "/bookcatalog?bookId=" + bookId) + "\">"
                        + messages.getString("CartAdd")
View Full Code Here


                    + "</TH>" + "<th align=left>"
                    + messages.getString("ItemPrice") + "</TH>" + "</tr>");

            Iterator i = cart.getItems()
                             .iterator();
            Currency c = (Currency) session.getAttribute("currency");

            if (c == null) {
                c = new Currency();
                c.setLocale(request.getLocale());
                session.setAttribute("currency", c);
            }

            while (i.hasNext()) {
                ShoppingCartItem item = (ShoppingCartItem) i.next();
                bd = (Book) item.getItem();
                c.setAmount(bd.getPrice());

                out.println(
                        "<tr>" + "<td align=\"right\" bgcolor=\"#ffffff\">"
                        + item.getQuantity() + "</td>"
                        + "<td bgcolor=\"#ffffaa\">" + "<strong><a href=\""
                        + response.encodeURL(
                                request.getContextPath()
                                + "/bookdetails?bookId=" + bd.getBookId())
                        + "\">" + bd.getTitle() + "</a></strong>" + "</td>"
                        + "<td bgcolor=\"#ffffaa\" align=\"right\">"
                        + c.getFormat() + "</td>" + "<td bgcolor=\"#ffffaa\">"
                        + "<strong>" + "<a href=\""
                        + response.encodeURL(
                                request.getContextPath()
                                + "/bookshowcart?Remove=" + bd.getBookId())
                        + "\">" + messages.getString("RemoveItem")
                        + "</a></strong>" + "</td></tr>");
            }

            c.setAmount(cart.getTotal());
            // Print the total at the bottom of the table
            out.println(
                    "<tr><td colspan=\"5\" bgcolor=\"#ffffff\">"
                    + "<br></td></tr>" + "<tr>"
                    + "<td colspan=\"2\" align=\"right\""
                    + "bgcolor=\"#ffffff\">" + messages.getString("Subtotal")
                    + "</td>" + "<td bgcolor=\"#ffffaa\" align=\"right\">"
                    + c.getFormat() + "</td>"
                    + "</td><td><br></td></tr></table>");

            // Where to go and what to do next
            out.println(
                    "<p> &nbsp; <p><strong><a href=\""
View Full Code Here

        try {
            Collection coll = bookDB.getBooks();

            Iterator i = coll.iterator();
            Currency c = (Currency) session.getAttribute("currency");

            if (c == null) {
                c = new Currency();
                c.setLocale(request.getLocale());
                session.setAttribute("currency", c);
            }

            while (i.hasNext()) {
                Book book = (Book) i.next();
                bookId = book.getBookId();
                c.setAmount(book.getPrice());

                //Print out info on each book in its own two rows
                out.println(
                        "<tr>" + "<td bgcolor=\"#ffffaa\">" + "<a href=\""
                        + response.encodeURL(
                                request.getContextPath()
                                + "/bookdetails?bookId=" + bookId)
                        + "\"> <strong>" + book.getTitle()
                        + "&nbsp; </strong></a></td>"
                        + "<td bgcolor=\"#ffffaa\" rowspan=2>" + c.getFormat()
                        + "&nbsp; </td>" + "<td bgcolor=\"#ffffaa\" rowspan=2>"
                        + "<a href=\""
                        + response.encodeURL(
                                request.getContextPath()
                                + "/bookcatalog?bookId=" + bookId)
View Full Code Here

        // set content-type header before accessing Writer
        response.setContentType("text/html");

        PrintWriter out = response.getWriter();
        Currency c = (Currency) session.getAttribute("currency");

        if (c == null) {
            c = new Currency();
            c.setLocale(request.getLocale());
            session.setAttribute("currency", c);
        }

        c.setAmount(cart.getTotal());

        // then write the data of the response
        out.println(
                "<html>" + "<head><title>" + messages.getString("TitleCashier")
                + "</title></head>");

        // Get the dispatcher; it gets the banner to the user
        RequestDispatcher dispatcher = getServletContext()
                                           .getRequestDispatcher("/banner");

        if (dispatcher != null) {
            dispatcher.include(request, response);
        }

        // Print out the total and the form for the user
        out.println(
                "<p>" + messages.getString("Amount") + "<strong>"
                + c.getFormat() + "</strong>" + "<p>"
                + messages.getString("Purchase") + "<form action=\""
                + response.encodeURL(request.getContextPath() + "/bookreceipt")
                + "\" method=\"post\">" + "<table summary=\"layout\">" + "<tr>"
                + "<td><strong>" + messages.getString("Name")
                + "</strong></td>"
View Full Code Here

        if (bookId != null) {

            // and the information about the book
            try {
               BookDetails bd = bookDB.getBookDetails(bookId);
               Currency c = new Currency();
               c.setLocale(request.getLocale());
               c.setAmount(bd.getPrice());
     

               //Print out the information obtained
               out.println("<h2>" + bd.getTitle() + "</h2>" +
                           "&nbsp; By <em>" + bd.getFirstName() + " " +
                           bd.getSurname() + "</em> &nbsp; &nbsp; " +
                           "(" + bd.getYear() + ")<br> &nbsp; <br>" +
                           "<h4>Here's what the critics say: </h4>" +
                           "<blockquote>" + bd.getDescription() +
                           "</blockquote>" +
                           "<h4>Our price: " + c.getFormat() + "</h4>" +
                           "<p><strong><a href=\"" +
                           response.encodeURL(request.getContextPath() + "/catalog?bookId=" + bookId) +
                           "\"> Add To Your Shopping Cart</a>&nbsp;&nbsp;&nbsp;" +
                           "<a href=\"" +
                           response.encodeURL(request.getContextPath() + "/catalog") + "\">Continue Shopping</a></p></strong>");
View Full Code Here

                        "<th align=left>Title</TH>" +
                        "<th align=left>Price</TH>" +
                        "</tr>");
           
            Iterator i = cart.getItems().iterator();
             Currency c = new Currency();
             c.setLocale(request.getLocale());
             while (i.hasNext()) {
                ShoppingCartItem item = (ShoppingCartItem) i.next();
                bd = (BookDetails) item.getItem();
                c.setAmount(bd.getPrice());
               
                out.println("<tr>" +
                            "<td align=\"right\" bgcolor=\"#ffffff\">" +
                            item.getQuantity() +
                            "</td>" +

                            "<td bgcolor=\"#ffffaa\">" +
                            "<strong><a href=\"" +
                            response.encodeURL(request.getContextPath() + "/bookdetails?bookId=" + bd.getBookId()) +
                            "\">" + bd.getTitle() + "</a></strong>" +
                            "</td>" +

                            "<td bgcolor=\"#ffffaa\" align=\"right\">" +
                            c.getFormat() +
                            "</td>" +

                            "<td bgcolor=\"#ffffaa\">" +
                            "<strong>" +
                            "<a href=\"" +
                            response.encodeURL(request.getContextPath() + "/showcart?Remove=" + bd.getBookId()) +
                            "\">Remove Item</a></strong>" +
                            "</td></tr>");
            }

            c.setAmount(cart.getTotal());
             // Print the total at the bottom of the table
            out.println("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">" +
                        "<br></td></tr>" +
                          "<tr>" +
                        "<td colspan=\"2\" align=\"right\"" +
                        "bgcolor=\"#ffffff\">" +
                        "Total:</td>" +
                        "<td bgcolor=\"#ffffaa\" align=\"right\">" +
                        c.getFormat() + "</td>" +
                        "</td><td><br></td></tr></table>");

          
            // Where to go and what to do next
            out.println("<p> &nbsp; <p><strong><a href=\"" +
View Full Code Here

         
         try {
               Collection coll = bookDB.getBooks();

               Iterator i = coll.iterator();
               Currency curr = new Currency();
               curr.setLocale(request.getLocale());
            while (i.hasNext()) {
                     BookDetails book = (BookDetails)i.next();
                     bookId = book.getBookId();
                     curr.setAmount(book.getPrice());
     
               //Print out info on each book in its own two rows
               out.println("<tr>" +

                           "<td bgcolor=\"#ffffaa\">" +
                           "<a href=\"" +
                           response.encodeURL(request.getContextPath() + "/bookdetails?bookId=" + bookId) +
                           "\"> <strong>" + book.getTitle() +
                           "&nbsp; </strong></a></td>" +

                           "<td bgcolor=\"#ffffaa\" rowspan=2>" +
                           curr.getFormat() +
                           "&nbsp; </td>" +

                           "<td bgcolor=\"#ffffaa\" rowspan=2>" +
                           "<a href=\"" +
                           response.encodeURL(request.getContextPath() + "/catalog?bookId=" + bookId)
View Full Code Here

        }
       
   // set content-type header before accessing Writer
       response.setContentType("text/html");
          PrintWriter out = response.getWriter();
       Currency c = new Currency();
       c.setLocale(request.getLocale());
       c.setAmount(cart.getTotal());

   // then write the data of the response
        out.println("<html>" +
                    "<head><title> Cashier </title></head>");

        // Get the dispatcher; it gets the banner to the user
        RequestDispatcher dispatcher =
               getServletContext().getRequestDispatcher("/banner");
                                      
            if (dispatcher != null)
               dispatcher.include(request, response);
              
       // Print out the total and the form for the user
        out.println("<p>Your total purchase amount is: " +
                    "<strong>" + c.getFormat() + "</strong>" +
                    "<p>To purchase the items in your shopping cart," +
                    " please provide us with the following information:" +

                    "<form action=\"" +
                    response.encodeURL(request.getContextPath() + "/receipt") +
View Full Code Here

        if (bookId != null) {

            // and the information about the book
            try {
               BookDetails bd = bookDB.getBookDetails(bookId);
               Currency c = (Currency)session.getAttribute("currency");
               if (c == null) {
                  c = new Currency();
                  c.setLocale(request.getLocale());
                  session.setAttribute("currency", c);
               }
               c.setAmount(bd.getPrice());
     

               //Print out the information obtained
               out.println("<h2>" + bd.getTitle() + "</h2>" +
                           "&nbsp;" + messages.getString("By") + " <em>" + bd.getFirstName() + " " +
                           bd.getSurname() + "</em> &nbsp; &nbsp; " +
                           "(" + bd.getYear() + ")<br> &nbsp; <br>" +
                           "<h4>" + messages.getString("Critics")+ "</h4>" +
                           "<blockquote>" + bd.getDescription() +
                           "</blockquote>" +
                           "<h4>" + messages.getString("Price") + c.getFormat() + "</h4>" +
                           "<p><strong><a href=\"" +
                           response.encodeURL(request.getContextPath() + "/bookcatalog?bookId=" + bookId) +
                           "\">" + messages.getString("CartAdd") + "</a>&nbsp;&nbsp;&nbsp;" +
                           "<a href=\"" +
                           response.encodeURL(request.getContextPath() + "/bookcatalog") + "\">" + messages.getString("ContinueShopping") + "</a></p></strong>");
View Full Code Here

                        "<th align=left>" + messages.getString("ItemTitle") + "</TH>" +
                        "<th align=left>" + messages.getString("ItemPrice") + "</TH>" +
                        "</tr>");
           
            Iterator i = cart.getItems().iterator();
            Currency c = (Currency)session.getAttribute("currency");
            if (c == null) {
               c = new Currency();
               c.setLocale(request.getLocale());
               session.setAttribute("currency", c);
            }
             while (i.hasNext()) {
                ShoppingCartItem item = (ShoppingCartItem) i.next();
                bd = (BookDetails) item.getItem();
                c.setAmount(bd.getPrice());
               
                out.println("<tr>" +
                            "<td align=\"right\" bgcolor=\"#ffffff\">" +
                            item.getQuantity() +
                            "</td>" +

                            "<td bgcolor=\"#ffffaa\">" +
                            "<strong><a href=\"" +
                            response.encodeURL(request.getContextPath() + "/bookdetails?bookId=" + bd.getBookId()) +
                            "\">" + bd.getTitle() + "</a></strong>" +
                            "</td>" +

                            "<td bgcolor=\"#ffffaa\" align=\"right\">" +
                            c.getFormat() +
                            "</td>" +

                            "<td bgcolor=\"#ffffaa\">" +
                            "<strong>" +
                            "<a href=\"" +
                            response.encodeURL(request.getContextPath() + "/bookshowcart?Remove=" + bd.getBookId()) +
                            "\">" + messages.getString("RemoveItem") + "</a></strong>" +
                            "</td></tr>");
            }

            c.setAmount(cart.getTotal());
             // Print the total at the bottom of the table
            out.println("<tr><td colspan=\"5\" bgcolor=\"#ffffff\">" +
                        "<br></td></tr>" +
                          "<tr>" +
                        "<td colspan=\"2\" align=\"right\"" +
                        "bgcolor=\"#ffffff\">" +
                        messages.getString("Subtotal") + "</td>" +
                        "<td bgcolor=\"#ffffaa\" align=\"right\">" +
                        c.getFormat() + "</td>" +
                        "</td><td><br></td></tr></table>");

          
            // Where to go and what to do next
            out.println("<p> &nbsp; <p><strong><a href=\"" +
View Full Code Here

TOP

Related Classes of util.Currency

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.