一、JavaBean的定义
1.javabean是固定写法的java类
2.javaBean在MVC设计模型中是model,又称模型层,在一般的程序中,我们称它为数据层,就是用来设置数据的属性和一些行为,然后我会提供获取属性和设置属性的get/set方法
二、JavaBean在JSP中的应用
1.JSP中使用JavaBean(现在使用较少,了解)
<jsp:useBean>标签
<jsp:setProperty>标签
<jsp:getProperty>标签
<jsp:useBean id="customer" class="com.atguigu.javaweb.Customer" scope="request"></jsp:useBean>
<!--这个和下面的效果是一致打的-->
Object customer = request.getAttribute("customer")
if(customer){
customer = Class.forName("com.atguigu.javaweb.Customer").newInstance();
request.setAttribute("customer", customer);
};