qq_火兹_03896205
2017-01-09 14:59
这是login_success.jsp的文件
<body>
<div id="container">
<div class="logo">
<a href="#"><img src="assets/logo.png" alt="" /></a>
</div>
<div id="box">
<%
String loginUser="";
if(session.getAttribute("loginUser")!=null)
{
loginUser=session.getAttribute("loginUser").toString();
}
%>
欢迎您<font color="red"><%=loginUser%>XXX</font>,登录成功!
</div>
</div>
</body>
这是dologin.jsp的文件
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String username ="";
String password ="";
request.setCharacterEncoding("utf-8"); //防止中文乱码
username=request.getParameter("username");
password=request.getParameter("password");
//如果用户密码都等于admin,则登录成功
if("admin".equals(username)&&"admin".equals(password))
{
session.setAttribute("loginUser",username);
request.getRequestDispatcher("login_success.jsp").forward(request,response);
}else
{
response.sendRedirect("login_failure.jsp");
}
%>
页面显示:
你把这句话 “ 欢迎您<font color="red"><%=loginUser%>XXX</font>,登录成功!”里的XXX 删除
JAVA遇见HTML——JSP篇
248278 学习 · 3071 问题
相似问题