我的第一个JSP网页,MyEclipse用浏览器打开中文乱码解决方法就在代码中!
<%@ 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 '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"> <meta name="content-type" content="text/html;charset=UTF-8"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> This is my JSP page. <br> table2<br> <table bgcolor = "#FFFF99" border="1" width="300"> <tr bgcolor="#FF3399"> <td>第一行第一格</td> <td bgcolor="#FFFF99">第一行第二格</td> </tr> <tr align="center"> <td align="left">第二行第一格</td> <td align="right">第二行第二格</td> </tr> <tr align="center" height="100" bgcolor="white"> <td height="150">第三行第一格</td> <td bgcolor="#FF3399">第三行第二格</td> </tr> </table> <p align="center">table3</p> <table align="center" cellpadding="5" bordercolor="#FF3399" cellspacing="20" bgcolor="#FFFF99" border="10" width="300"> <tr align="center"> <td>表格</td> <td>表格</td> </tr> <tr align="center"> <td>表格</td> <td>表格</td> </tr> </table> <table border="1" width="300"> <tr> <td rowspan="2">纵向合并</td> <td>表格</td> <td>表格</td> </tr> <tr> <td>表格</td> <td>表格</td> </tr> </table> <hr> <table border="1" width="300"> <tr> <td colspan="2">横向合并</td> </tr> <tr> <td>表格</td> <td>表格</td> </tr> <tr> <td>表格</td> <td>表格</td> </tr> </table> <a href="MyHtml.html">这是MyHtml.html</a> 欢迎注册<br> <form> 输入账号(文本框):<input type="text" name=""><br> 输入密码(密码框):<input type="password" name=""><br> 选择性别(单选按钮): <input type="radio" name="sex" checked>男 <input type="radio" name="sex">女<br> 选择爱好(复选框): <input type="checkbox">唱歌 <input type="checkbox">跳舞 <input type="checkbox">打球 <input type="checkbox">打游戏<br> <input type="submit" value="注册"> <input type="reset" value="清空"> <input type="button" value="普通按钮"> </form> <form> 填写个人信息:<br> <textarea rows="5" cols="20"></textarea><br> 选择家乡(下拉菜单): <select> <option >上海</option> <option selected>北京</option> <option >纽约</option> </select><br> 选择家乡(下拉列表,可以多选):<br> <select size="5" multiple> <option >上海</option> <option selected>北京</option> <option >纽约</option> </select><br> </form> </body> </html>