实体类
JavaBean有特定的写法:
- 必须要有一个无参构造属性必须私有化
- 必须有对应的get/set方法;
- 一般用来和数据库的字段做映射ORM;
ORM:对象关系映射
<%
//People peopLe = new People();peoplLe.setAddress( );
//people.setId();
//people.setAge();
//peopLe.setName();
%>
<jsp:useBean id="people" class="com.kuang.pojo.People" scope="page"/>
<jsp:setProperty name="people" property="address" value="西安"/>
<jsp:setProperty name="people" property="id" value="1"/>
<jsp:setProperty name="people" property="age" value="3"/>
<jsp:setProperty name="people" property="name" value="小小"/>
<%--<%=people.getAddress( )%>--%>
姓名: <jsp:getProperty name="people" property="name"/>
id: <jsp:getProperty name="people" property="id" />
年龄:<jsp:getProperty name="people" property="age" />
地址:<jsp:getProperty name="people" property="address" />
网友评论