123456147% 2021-12-13 09:34 采纳率: 64.7%
浏览 21
已结题

运行时中英文全是 ?jsp 改成gbk utf-8 都不行

package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.MulticastSocket;
import java.sql.Array;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.tdDao;
import dao.impl.tdDaoimpl;
import entity.td;

/**
 * Servlet implementation class listservlet
 */
@WebServlet("/listservlet")
public class listservlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public listservlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out=    response.getWriter();
        request.setCharacterEncoding("utf-8");
        tdDao dao=new tdDaoimpl();
        td t=new td();
    ArrayList<td> list=(ArrayList<td>) dao.select();
    
        request.setAttribute("list", list);
        request.getRequestDispatcher("list.jsp").forward(request, response);
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }

}

<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*,entity.*,dao.*,dao.impl.*"
    pageEncoding="UTF-8"%>
  <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>

<body>
<c:set var="ArrayList list" value="(ArrayList) request.getAttribute('list')" scope="request"></c:set>
<table border="1" contenteditable="0" contextmenu="0">
<tr>
<td>编号</td>
<td>品牌名称</td>
<td>企业名称</td>
<td>排序字段<td>
<td>状态</td>
</tr>
<c:forEach var="s" items="${list}">
    <tr>
    <td>${s.id}</td>
    <td>${s.brandname}</td>
    <td>${s.companyname}</td>
    <td>${s.orderd}</td>
    <td>${s.status}</td>
    <td><a href="add.jsp">添加</a>&nbsp;<a href="deleteservlet?id=${s.id}">注销</a> &nbsp; <a href="Toupdateservlet?id=${s.id}">修改</a></td>
    </tr>
 </c:forEach>

</table>
</body>
</html>

img

```

  • 写回答

1条回答 默认 最新

  • 普通网友 2021-12-13 09:43
    关注

    是编辑器的问题,你用浏览器打开就可以;
    不要用默认的eclipse中的浏览器即可

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 7月26日
  • 已采纳回答 7月18日
  • 创建了问题 12月13日

悬赏问题

  • ¥15 请问各位,如何在Jetson nano主控板的Ubuntu系统中安装PyQt5
  • ¥15 MAC安装佳能LBP2900驱动的网盘提取码
  • ¥400 微信停车小程序谁懂的来
  • ¥15 ATAC测序到底用什么peak文件做Diffbind差异分析
  • ¥15 安装ubantu过程中第一个vfat 文件挂载失败
  • ¥20 GZ::CTF如何兼容一些靶机?
  • ¥15 etcd集群部署问题
  • ¥20 谁可以帮我一下问一下各位
  • ¥15 为何重叠加权后love图的SMD与svyCreateTableOne函数绘制基线表的不一致
  • ¥150 求 《小魔指》街机游戏机整合模拟软件