怎么编写一个JSP的页面,能实现在表单中输入用户名和密码并按下提交按扭后,在另一页面显示提交信息?
展开全部
A页是静态页
<html>
<head>
<title>发表</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<form action="affirm.jsp" method="post">
标题:<input type="text" name="title" /><br/>
内容:<textarea rows="5" cols="20" name="content"></textarea><br/>
<input type="submit" value="提 交" />
</form>
</body>
</html>
B页JSP跳转页
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
request.setCharacterEncoding("GBK");
response.setCharacterEncoding("GBK");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String title = request.getParameter("title");
String content = request.getParameter("content");
%>
<html>
<head>
<base href="<%=basePath%>">
<title>确认</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">
</head>
<body>
<table>
<tr>
<td>标题:</td><td><%=title %></td>
</tr>
<tr>
<td>内容:</td><td><%=content %></td>
</tr>
</table>
<input type="text" value="<%=title %>"/><br/>
<textarea rows="5" cols="20"><%=content %></textarea>
</body>
</html>
<html>
<head>
<title>发表</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
</head>
<body>
<form action="affirm.jsp" method="post">
标题:<input type="text" name="title" /><br/>
内容:<textarea rows="5" cols="20" name="content"></textarea><br/>
<input type="submit" value="提 交" />
</form>
</body>
</html>
B页JSP跳转页
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
request.setCharacterEncoding("GBK");
response.setCharacterEncoding("GBK");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String title = request.getParameter("title");
String content = request.getParameter("content");
%>
<html>
<head>
<base href="<%=basePath%>">
<title>确认</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">
</head>
<body>
<table>
<tr>
<td>标题:</td><td><%=title %></td>
</tr>
<tr>
<td>内容:</td><td><%=content %></td>
</tr>
</table>
<input type="text" value="<%=title %>"/><br/>
<textarea rows="5" cols="20"><%=content %></textarea>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |