javaBean实例赋值 中文有乱码 请大神看一眼
login文件 <%@ page language="java" import="java.util.* " contentType="text/html; charset=utf-8"%> <% 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 'index.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"> --> <style> </style> </head> <body> <fieldset> <legend>login</legend> <h1>提交</h1> 密码 <form action="dologin.jsp" name="loginform" method="post"> <br> 用户名<input type="text" name="username"> <br> 密码<input type="password" name="password"> <br> 爱好<input type="checkbox" name="favorite" value="ww"> 看历史<br> <input type="checkbox" name="favorite" value="music">欣赏音乐 <br> <input type="checkbox" name="favorite" value="欣赏电影">欣赏电影 <br> <input type="checkbox" name="favorite" value="运动">运动 <br> <input type="submit" value="登录"> </form> </fieldset> </body> </html>
dologin文件
<%@ page language="java" import="java.util.* " contentType="text/html; charset=utf-8"%> <% 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 'index.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"> --> <style> </style> </head> <body> <jsp:useBean id="user" class="po.Users" scope="page"></jsp:useBean> <jsp:setProperty property="*" name="user" /> 用户名:<%=user.getUsername() %> <br> 密码:<%=user.getPassword() %><br> </body> </html>