?? showquote_jsp.java
字號:
package examples;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import examples.ProductItem;
import examples.LineItem;
import java.text.NumberFormat;
public final class showQuote_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
"error.jsp", true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n<HTML>\r\n <head><title> Jasmine's Shopping Cart page </title></head>\r\n <body>\r\n ");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "title.jsp", out, false);
out.write("\r\n\t\r\n \r\n \r\n \r\n <form action=\"/jasmine/showQuote\" method=\"get\"> \r\n <center><table>\r\n <tr>\r\n\t\t\t<th align=left> Name </TH>\r\n\t\t\t<th align=left> Quantity </TH>\r\n\t\t\t<th align=left> Individual Base Price </TH>\r\n\t\t\t<th align=left> Discount </TH>\r\n\t\t\t<th align=left><strong> Total Price </strong></TH>\r\n\t\t\t<th align=left>Modify Quantity</TH>\r\n </tr>\r\n ");
// get the lineItems from the request object and displays in a table format.
java.util.Enumeration lineItems = ((java.util.Vector) request.getAttribute("lineItems")).elements();
double subTotal=((Double)request.getAttribute("subTotal")).doubleValue();
double taxes=((Double)request.getAttribute("taxes")).doubleValue();
double total=((Double)request.getAttribute("total")).doubleValue();
while (lineItems.hasMoreElements()) {
LineItem li = (LineItem) lineItems.nextElement();
int quantity = li.getQuantity();
double discount = li.getDiscount();
ProductItem product = li.getProductItem();
String productID = product.getProductID();
double basePrice = product.getBasePrice();
out.write("\r\n <tr>\r\n <td bgcolor=\"#ffffaa\"><a href=\"/jasmine/catalog?productId=");
out.print(product.getProductID());
out.write("\"><b>");
out.print(product.getName());
out.write("<b></td>\r\n <td align=\"right\" bgcolor=\"#ffffff\">");
out.print(quantity);
out.write("</td>\r\n <td bgcolor=\"#ffffaa\" align=\"right\">");
out.print(NumberFormat.getCurrencyInstance().format(basePrice));
out.write("</td>\r\n <td bgcolor=\"#ffffaa\" align=\"right\">");
out.print(NumberFormat.getCurrencyInstance().format(discount));
out.write("</td>\r\n <td bgcolor=\"#ffffaa\" align=\"right\">");
out.print(NumberFormat.getCurrencyInstance().format((basePrice* quantity) - discount ));
out.write("</td>\r\n <td><input type=\"text\" name=\"");
out.print(productID);
out.write("\" value=\"");
out.print(quantity);
out.write("\"></td>\r\n </tr>\r\n ");
}
out.write("\r\n </table></center>\r\n <br>\r\n <center><table>\r\n <tr>\r\n <td colspan=\"2\" align=\"right\" bgcolor=\"#ffffff\"> Subtotal:</td>\r\n <td bgcolor=\"#ffffaa\" align=\"right\"> ");
out.print(NumberFormat.getCurrencyInstance().format(subTotal));
out.write("</td>\r\n <td> <br></td> \r\n </tr>\r\n <tr>\r\n <td colspan=\"2\" align=\"right\" bgcolor=\"#ffffff\">Sales Tax: </td>\r\n <td bgcolor=\"#ffffaa\" align=\"right\">");
out.print(NumberFormat.getCurrencyInstance().format(taxes));
out.write("</td>\r\n <td><br></td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"2\" align=\"right\" bgcolor=\"ffffff\"> <font color=\"ff0000\"> <strong>Grand Total:</strong></font> </td>\r\n <td bgcolor=\"#ffffaa\" align=\"right\">");
out.print(NumberFormat.getCurrencyInstance().format(total));
out.write("</td>\r\n <td><br></td> \r\n </tr>\r\n </table></center>\r\n <!--\r\n Print out links and buttons for user feedback.\r\n When the customer clicks a button to perform an \r\n action (such as submitting an order), sends request to\r\n\t\t the servlet with necessary parameters to process the request.\r\n //-->\r\n <p>\r\n <A href=\"/jasmine/catalog\">See the Catalog</A>\r\n <input type=\"reset\" value=\"Reset Values\"> \r\n <input type=\"submit\" name=\"Update\" value=\"Update Quantities\"> \r\n <input type=\"submit\" name=\"Order\" value=\"Submit Order\"> \r\n <input type=\"submit\" name=\"Clear\" value=\"Clear Cart\"> \r\n\r\n ");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "footer.jsp", out, false);
out.write("\r\n </form>\r\n </body>\r\n</html>\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -