Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I convert this to jsp expression language (EL)? Wrox Shopping Mall Wrox JSTL Web Store ${curCat.name} Item Price Order ${curItem.name} BUY Wrox Shopping

How do I convert this to jsp expression language (EL)?

<%@page import="java.text.NumberFormat"%> <%@ page language="java" import = "cart.*,java.util.*" session="true" %>

<%! private static String EXAMPLE = "/myShoppingCart"; private static String SHOP_PAGE = "/estore.jsp"; private static String CART_PAGE = "/shopcart.jsp"; private static String CHECKOUT_PAGE = "/checkOut.jsp";

NumberFormat nf = NumberFormat.getCurrencyInstance(); %>

<%@include file="../includes/header.jsp" %> <% ArrayList items = (ArrayList) session.getAttribute("lineitems"); String action = request.getParameter("action"); String sku = request.getParameter("sku"); Product prod = null; if (sku != null) prod = EShop.getItem(sku);

if (items == null) { // add first item items = new ArrayList(); items.add(new LineItem(1,sku,prod.getName(), prod.getPrice() )); session.setAttribute("lineitems", items); } else if (action.equals("clear")) { items.clear(); } else if (action.equals("remove")) { for (int i = 0; i < items.size(); i++) { LineItem curItem = (LineItem) items.get(i); if (curItem.getQuantity() == 1) { items.remove(i); } else { curItem.setQuantity(curItem.getQuantity() - 1); } break; } } else { boolean itemFound = false; // check to see if sku exists for (int i=0; i LineItem curItem = (LineItem) items.get(i); if (curItem.getSku().equals(sku)) { itemFound = true; curItem.setQuantity(curItem.getQuantity() + 1); break; } // of if } //of for

if (!itemFound) items.add(new LineItem(1,sku,prod.getName(), prod.getPrice() )); } // of final else int total = 0; double tax = 0; double withTax = 0; %>

<%@include file="../includes/footer.jsp" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="wxshop" uri="EShopFunctionTagLibrary" %>

<%@ page session="true" %>

Wrox Shopping Mall

Wrox JSTL Web Store
${curCat.name}

ItemPriceOrder
${curItem.name} BUY

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="wxshop" uri="myShoppingCartTagLibrary" %>

<%@ page session="true" %>

Wrox Shopping Mall - Shopping Cart

${wxshop:clearList(lineitems)}

${wxshop:addList(lineitems, tmpitem)}

VWCC JSTL Web Store

Your Shopping Cart
QuantityItemPrice Extended Add
${curItem.quantity} ${curItem.desc}

Add 1

Total:
Clear the cart
Return to Shopping

<%-- Document : checkOut Created on : Feb 11, 2011, 1:27:24 PM Author : eroberts --%> <%@ page language="java" import = "cart.*,java.util.*" session="true" %> <% String message = (String) request.getAttribute("message"); String email = (String) request.getAttribute("email"); String password = (String) request.getAttribute("password");

if (email == null) { email = ""; } if (password == null) { password = ""; } if (message == null) { message=""; } %> <%@include file="../includes/header.jsp" %>

Email address:
Password:
<%@include file="../includes/footer.jsp" %>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions