解决jsp中乱码问题和打印用户名密码的方法
来源:互联网 发布:网络音乐吧 点歌 编辑:程序博客网 时间:2024/06/04 18:12
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
//解决乱码
request.setCharacterEncoding("utf-8");
//打印用户名
String username = request.getParameter("username");
//非空验证
if(username.equals("admin")){
//提示用户已存在,不能注册
request.setAttribute("message", "用户名已存在,请重新输入");
request.getRequestDispatcher("userLogin.jsp").forward(request, response);
}else{
//提示注册成功
request.setAttribute("message","注册成功!");
response.sendRedirect("success.jsp");
}
//String un = new String(username.getBytes("iso-8859-1"),"utf-8");
String password = request.getParameter("password");
out.println("username:" +username+"<br/>");
out.println("password:"+password+"<br/>");
%>
</body>
</html>
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
//解决乱码
request.setCharacterEncoding("utf-8");
//打印用户名
String username = request.getParameter("username");
//非空验证
if(username.equals("admin")){
//提示用户已存在,不能注册
request.setAttribute("message", "用户名已存在,请重新输入");
request.getRequestDispatcher("userLogin.jsp").forward(request, response);
}else{
//提示注册成功
request.setAttribute("message","注册成功!");
response.sendRedirect("success.jsp");
}
//String un = new String(username.getBytes("iso-8859-1"),"utf-8");
String password = request.getParameter("password");
out.println("username:" +username+"<br/>");
out.println("password:"+password+"<br/>");
%>
</body>
</html>
1 0
- 解决jsp中乱码问题和打印用户名密码的方法
- jsp Textarea中解决中文乱码和换行的问题
- Ubuntu下解决Git保存用户名和密码的方法
- jsp中解决中文乱码的方法
- 解决Mysql用户名和密码忘记的问题
- JSP中日文乱码问题的解决
- JSP中有关乱码问题的解决
- 解决JSP中出现乱码的问题
- 解决浏览器记住用户名和密码问题
- 解决jsp中乱码问题
- jsp中解决乱码问题
- 在项目中记住Github用户名和密码的方法
- 解决oem中任务调度部分输入正确windows用户名和密码不能执行任务的问题
- servlet中out.print打印出乱码问题的解决
- jsp乱码问题的解决
- JSP乱码问题的解决
- Jsp乱码问题的解决
- jsp乱码问题的解决
- Myeclipse10破解 run.bat 闪退
- GUI简单学习笔记
- 2017年团体程序设计天梯赛-大区赛 L3-01. 非常弹的球
- 第十五篇:状态模式
- Android Tasks、ActivityStack和Activity
- 解决jsp中乱码问题和打印用户名密码的方法
- Linux正则表达式基础
- HDU2050(递归)折线分割平面
- Python实现神经网络Part 3: 多层全连接神经网络
- 1Java学习笔记之数据结构——单链表
- 04-树6 Complete Binary Search Tree (30分)
- struts配置中type参数中“redirectAction” 与“chain” 的区别
- A Learned Representation for Artistic Style论文理解
- UvaLive 3704 Cellular Automaton (矩阵快速幂)