📄 catalog_jsp.java
字号:
package examples;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import examples.ProductItem;
public final class catalog_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,
null, 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\r\n<html>\r\n <head><title> Jasmine's Catalog page </title></head>\r\n <body>\r\n ");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "title.jsp", out, false);
out.write("\r\n <h3><A HREF=\"/jasmine/showQuote\">View Current Shopping Cart</A></h3>\r\n <h3>Please choose from our selections</h3>\r\n <center><table> \r\n ");
//Retrieves catalog vector from HTTPSession and displays product item details in a table format
session = request.getSession(false);
java.util.Vector products=(java.util.Vector)session.getAttribute("products");
int size=products.size();
ProductItem item=null;
for(int i=0; i<size;i++){
item=(ProductItem)products.elementAt(i);
out.write("\r\n <tr>\r\n <td bgcolor=\"#ffffaa\"><a href=\"/jasmine/catalog?productId=");
out.print(item.getProductID());
out.write("\"><b>");
out.print(item.getName());
out.write("<b></td>\r\n <td align=\"right\" bgcolor=\"#ffffaa\">");
out.print(item.getBasePrice());
out.write("</td> \r\n <td bgcolor=\"#ffffaa\"> <A HREF=\"/jasmine/catalog?Buy=");
out.print(item.getProductID());
out.write("\"> Add to Cart</A></td>\r\n </tr>\r\n ");
}
out.write("\r\n </table></center>\r\n <P>\t \r\n ");
// Displays the name of the product item added to the cart, at the bottom of the page.
String productName = (String) request.getAttribute("ProductPurchased");
if (productName != null) {
out.write("\r\n <i> ");
out.print(productName);
out.write("</i> has been added to your shopping cart.\r\n ");
}
out.write("\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 + -