编写一个Student的javaBean,在页面中通过EL表达式输出其属性值,并将属性值绑定在文本框中显示
展开全部
<%@ page language="java" import="java.util.*" pageEncoding="GBK" isELIgnored="false"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'test.jsp' starting page</title>
</head>
<body>
<jsp:useBean id="user" class="com.orilore.bean.UserBean" scope="page"></jsp:useBean>
<jsp:setProperty property="name" name="user" value="张三"/>
<%
pageContext.setAttribute("user",user);
%>
<h1>usrbean:${pageScope.user.name }</h1>
</body>
</html>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'test.jsp' starting page</title>
</head>
<body>
<jsp:useBean id="user" class="com.orilore.bean.UserBean" scope="page"></jsp:useBean>
<jsp:setProperty property="name" name="user" value="张三"/>
<%
pageContext.setAttribute("user",user);
%>
<h1>usrbean:${pageScope.user.name }</h1>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询