完成JSP+JavaBean的基本实验
2017-03-30 20:11 左右s 阅读(261) 评论(0) 收藏 举报<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<jsp:useBean id="mystudent" scope="page" class="com.zss.www.Student">
</jsp:useBean>
<jsp:setProperty name="mystudent" property="userName" param="userName1"/>
<jsp:setProperty name="mystudent" property="passwrod" param="passwrod1"/>
<%
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>
<base href="<%=basePath%>">
<title>My JSP 'receiver.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%=mystudent.getUserName() %><br>
<%=mystudent.getPasswrod() %><br>
</body>
</html>
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SEND</title>
</head>
<body>
<form id="form1" name="form1" method="get" action="receiver.jsp">
<p>姓名:
<label>
<input type="text" name="userName" id="textfield" />
</label>
</p>
<p>密码:
<label>
<input type="text" name="passwrod" id="textfield2" />
</label>
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="提交" />
</label>
</p>
</form>
</body>
</html>
浙公网安备 33010602011771号