code050.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>保存新闻</title>
</head>
<body>
<jsp:useBean id="news" class="pack01.code047"></jsp:useBean>
<jsp:useBean id="encoding" class="pack01.code048"></jsp:useBean>
<jsp:setProperty property="*" name="news"/><%-- 类属性名与表单控件name一致时,可以此种方式 --%>
<jsp:setProperty property="title" name="news" param="title"/><%-- 表单控件与属性名有区别,分开处理,param表示表单控件 --%>
<jsp:setProperty property="content" name="news" param="content"/>
<div align="center">
<div id="container">
<div id="title">
<%= encoding.toString(news.getTitle()) %>
</div>
<hr>
<div id="content">
<%= encoding.toString(news.getContent()) %>
</div>
</div>
</div>
</body>
</html>