javaweb session出不来呀
三个文件的代码分别为:login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="server.jsp" method="post">
<table>
<tr>
<tb>姓名:<input type="text" name="name"/></tb><br>
<tb>密码:<input type="password"name="passwd"/></tb><br>
</tr>
<tr>
<input type="submit" value="提交">
</tr>
</table>
</form>
</body>
</html>
server.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="server.jsp" method="post">
<table>
<tr>
<tb>姓名:<input type="text" name="name"/></tb><br>
<tb>密码:<input type="password"name="passwd"/></tb><br>
</tr>
<tr>
<input type="submit" value="提交">
</tr>
</table>
</form>
</body>
</html>
loginSuccess.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<% String name=(String)session.getAttribute("name").toString();
%>
欢迎<%=name%>
</body>
</html>
最后一步出现:
HTTP Status 404 – Not Found
Type Status Report
Message /%E5%86%85%E7%BD%AE%E5%87%BD%E6%95%B0/%E4%BD%9C%E4%B8%9A/loginSuccsess.jsp
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
好了解决了 {:10_279:}
页:
[1]