Acticle:
package com.huizhi.bean;
public class Acticle {
private int id;
private String title;
private String author;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}
useBean.jsp:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<jsp:useBean id="article" class="com.huizhi.bean.Acticle"/>
<jsp:setProperty name="article" property="id" value="520"/>
<jsp:setProperty name="article" property="title" value="关于学生教育"/>
<jsp:setProperty name="article" property="author" value="人文雷老师"/>
<p>
编号:<jsp:getProperty name="article" property="id"/><br>
标题:<jsp:getProperty name="article" property="title"/><br>
作者:<jsp:getProperty name="article" property="author"/>
</p>
</body>
</html>
来源:CSDN
作者:雷玉广
链接:https://blog.csdn.net/weixin_39593940/article/details/104446830