<jsp:useBean id="实例化对象名称" scope="保存范围" class="包.类名"> </jsp:useBean>
<jsp:useBean id="book" scope="page" class="com.zhiqi.model.Book"></jsp:useBean> <% book.setBookName("数据结构"); book.setPrice(35.50); book.setAuthor("严蔚敏"); %> <%=book.getBookName() %> <%=book.getPrice() %> <%=book.getAuthor() %>
语法包括:【setProperty】property="*"//自动匹配所有
【property="分别设置"】value指定值
【getProperty】
<jsp:useBean id="bo" scope="page" class="com.zhiqi.model.Book"></jsp:useBean> <jsp:setProperty name="bo" property="bookName" value="Oracle"></jsp:setProperty> <jsp:setProperty name="bo" property="price" value="45"></jsp:setProperty> <jsp:setProperty name="bo" property="author" value="萨师煊"></jsp:setProperty> <jsp:getProperty name="bo" property="bookName"></jsp:getProperty> <jsp:getProperty name="bo" property="price"></jsp:getProperty> <jsp:getProperty name="bo" property="author"></jsp:getProperty>
【javaBean删除】
Page pageContext.removeAttribute() Request request.removeAttribute() Session session.removeAttribute() Application application.removeAttribute()