在MyEclipse中设置JSP编码格式
2013-12-11 19:32
281 查看
今天我新建了一个JSP文件,写了样例,启动服务器发现页面乱码。经过检查,发现新建的JSP文件的编码格式是“ISO-8859-1”,后来改成“UTF-8”,页面也不乱码了。随后,我想如果新建JSP默认的编码格式是“UTF-8”就好了。
在网上查询资料,我发现没有几个正确答案,于是问了一下同事,最终改了JSP默认编码。
1、未改编码之前,新建的JSP页面
3、找到“MyEclipse->Files and Editors->JSP”
4、编码格式选择“UTF-8”
5、点击“Apply”,单击“OK”,然后再次新建JSP文件
在网上查询资料,我发现没有几个正确答案,于是问了一下同事,最终改了JSP默认编码。
1、未改编码之前,新建的JSP页面
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <% 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 'school.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"> --> </head> <body> This is my JSP page. <br> </body> </html>2、依次点击“Window->Preference”
3、找到“MyEclipse->Files and Editors->JSP”
4、编码格式选择“UTF-8”
5、点击“Apply”,单击“OK”,然后再次新建JSP文件
<%@ page language="java" import="java.util.*" pageEncoding="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 'MyJsp.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"> --> </head> <body> This is my JSP page. <br> </body> </html>
相关文章推荐
- Myeclipse设置jsp编码格式
- 在MyEclipse中设置JSP编码格式
- 设置myeclipse的JSP、HTML的页面编码格式
- MyEclipse开发平台下如何将新建的JSP页面的默认编码格式设置为UTF-8--JSP
- Myeclipse技巧-jsp设置默认编码格式
- Myeclipse将Jsp默认编码格式设置为utf-8
- MyEclipse设置新的jsp默认的编码格式
- MyEclipse中文乱码,编码格式设置,文件编码格式
- myeclipse中的jsp设置默认打开方式和打开编码
- Myeclipse设置编码格式
- 设置myeclipse新建jsp文件默认编码为UTF-8
- Servlet和Jsp 设置编码格式
- MyEclipse下修改jsp文件的默认编码格式
- myeclipse2017基础 设置新建jsp文件的编码格式
- 转】MyEclipse使用总结——在MyEclipse中设置jsp页面为默认utf-8编码
- myeclipse设置编码格式的4种情况
- jsp-property-group 设置 解决jsp编码格式
- myeclipse中的jsp页面pageEncoding怎样设置默认编码为“UTF-8”
- JSP编码格式设置
- MyEclipse 设置全部jsp的编码为UFT-8 的方法