在如下所示的jsp程序中(如下所示),CartBean 的使用是如第3行所示,而
BookBean 的使用却如最后一行示.请问这两种使用javabean的方式有何异同?
<%@page contentType="text/html; charset=GB2312"%>
<%@include file="common.jsp"%>
<jsp:useBean id="cart" scope="session"
class="org.sunxin.lesson.jsp.bookstore.CartBean"/>
<html>
<head><title>欢迎光临网上书店</title></head>
<body>
<jsp:include page="additem.jsp" flush="false"/>
<%
String strBookId = request.getParameter("id");
if (null == strBookId || "".equals(strBookId))
{
response.sendRedirect("catalog.jsp");
return;
}
else
{
int bookId = Integer.parseInt(strBookId);
BookBean book = bookdb.getBook(bookId);
剩下程序省略.
BookBean 的使用却如最后一行示.请问这两种使用javabean的方式有何异同?
<%@page contentType="text/html; charset=GB2312"%>
<%@include file="common.jsp"%>
<jsp:useBean id="cart" scope="session"
class="org.sunxin.lesson.jsp.bookstore.CartBean"/>
<html>
<head><title>欢迎光临网上书店</title></head>
<body>
<jsp:include page="additem.jsp" flush="false"/>
<%
String strBookId = request.getParameter("id");
if (null == strBookId || "".equals(strBookId))
{
response.sendRedirect("catalog.jsp");
return;
}
else
{
int bookId = Integer.parseInt(strBookId);
BookBean book = bookdb.getBook(bookId);
剩下程序省略.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货