<select>中文乱码

在web.config中加入红色行代码即可  

<system.web>

    <globalization requestEncoding="gb2312"  responseEncoding="gb2312" />
    <sessionState mode="InProc" timeout="30" />
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
    </httpModules>
  </system.web>
``` <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="java.sql.*"%> <table border="1"> <tr> <th>身份证号</th><th>密码</th><th>姓名</th><th>性别</th><th>单位</th> <th>电话</th><th>单位地址</th><th>邮箱</th><th>报考类别</th><th>备注</th><th>操作</th> </tr> <tr> <td>身份证号</td><td>密码</td><td>姓名</td><td>性别</td><td>单位</td> <td>电话</td><td>单位地址</td><td>邮箱</td><td>报考类别</td><td>备注</td><td><a href="">修改</a>|<a href="">删除</a></td> </tr> <% try{ Class.forName("com.mysql.jdbc.Driver"); }catch (ClassNotFoundException e){ out.println("数据加载失败:"+e.toString()); } Connection con=null; PreparedStatement pstmt=null; ResultSet rs =null; try{ con=DriverManager.getConnection("jdbc:mysql://localhost:3306/bmdb?useSSL=false","root","123456"); //2、创建数据库的访问连接 pstmt=con.prepareStatement("select * from dm");//3、获取sql执行对象 rs=pstmt.executeQuery();//5、执行sql获得结果集 while(rs.next()){//6、根据查询结果判断是否登陆成功 %> <tr> <td>身份证号</td><td>密码</td><td>姓名</td><td>性别</td><td>单位</td> <td>电话</td><td>单位地址</td><td>邮箱</td><td>报考类别</td><td>备注</td><td><a href="">修改</a>|<a href="">删除</a></td> </tr> <% }catch (SQLException e){ out.println("SQL异常:"+e.toString()); }finally { rs.close(); pstmt.close(); con.close(); } %> </table>```修改图中的信息,改为正确的代码
03-29
<%-- Created by IntelliJ IDEA. User: PC78 Date: 2025/10/14 Time: 16:14 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> </head> <body> <form action="stu_info.jsp" method="post"> <h3 style="color:blue">个人信息</h3> 姓名:<input type="text" name="name"><br> 学号:<input type="text" name="studentId"><br> 性别: <input type="radio" name="gender" value="男">男 <input type="radio" name="gender" value="女">女<br> 所在专业: <select name="major"> <option value="计算机软件专业" selected>计算机软件专业</option> <option value="网络工程专业">网络工程专业</option> <option value="信息安全专业">信息安全专业</option> </select><br> 兴趣爱好: <input type="checkbox" name="hobby" value="编程">编程 <input type="checkbox" name="hobby" value="阅读">阅读 <input type="checkbox" name="hobby" value="运动">运动<br> <input type="submit" value="提交"> <input type="reset" value="重置"> </form> </body> </html> <%-- Created by IntelliJ IDEA. User: PC78 Date: 2025/10/14 Time: 16:25 To change this template use File | Settings | File Templates. --%> <!-- result.jsp --> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> <style> body {font-family: "黑体"; font-size: 35;} </style> </head> <body> request.setCharacterEncoding("UTF-8"); <h3>您提交的信息如下:</h3> 姓名:<%= request.getParameter("name") %><br> 学号:<%= request.getParameter("studentId") %><br> 性别:<%= request.getParameter("gender") %><br> 专业:<%= request.getParameter("major") %><br> 兴趣爱好:<%= String.join(", ", request.getParameter("hobby")) %><br> </body> </html> 提交后第二页面出现中文乱码问题
10-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值