南风知我意468 2022-10-07 17:04 采纳率: 100%
浏览 8
已结题

语法报错请问各位大手这语法怎么错了刚学看不出来

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

/**

  • Servlet implementation class course

  • /
    @WebServlet("/course")
    public class course extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**

    • @see HttpServlet#HttpServlet()
    • /
      public course() {
      super();
      // TODO Auto-generated constructor stub
      }

    /**

    • @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    • /
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      doPost (request, response);
      }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    { request.setCharacterEncoding("utf-8");

      String mingzi= request.getParameter("mingzi");
      String xuehao= request.getParameter("xuehao");
      String mima= request.getParameter("mima");
      String xingbei= request.getParameter("xingbei");
      String department= request.getParameter("department");        
      String[] ch1= request.getParameterValues("ch1");
      String email= request.getParameter("email");
      String memo= request.getParameter("beizhu");
      
      response.setContentType("text/html;charset=utf-8");
       response.getWriter().write("

    姓名: "+mingzi+"

    "
    ); response.getWriter().write("

    学号: "+xuehao+"

    "
    ); response.getWriter().write("

    密码: "+mima+"

    "
    ); response.getWriter().write("

    性别: "+xingbei+"

    "
    ); response.getWriter().write("

    系部: "+department+"

    "
    ); response.getWriter().write("

    所选课程: "+ch1+"

    "
    ); response.getWriter().write("

    邮箱: "+email+"

    "
    ); response.getWriter().write("

    备注: "+memo+"

    "
    ); for(int i=0;ch1!=null && i<ch1.length;i++){ response.getWriter().write("

    所选课程"+ch1[i]+"

    img

img

  • 写回答

1条回答 默认 最新

  • 懒人猿 2022-10-07 17:30
    关注

    少打一个大括号吧

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

报告相同问题?

问题事件

  • 系统已结题 10月16日
  • 已采纳回答 10月8日
  • 创建了问题 10月7日

悬赏问题

  • ¥30 关于#java#的问题,请各位专家解答!
  • ¥20 pcf8563时钟芯片不启振
  • ¥20 pip2.40更新pip2.43时报错
  • ¥15 换yum源但仍然用不了httpd
  • ¥50 C# 使用DEVMOD设置打印机首选项
  • ¥15 麒麟V10 arm安装gdal
  • ¥20 OPENVPN连接问题
  • ¥15 flask实现搜索框访问数据库
  • ¥15 mrk3399刷完安卓11后投屏调试只能显示一个设备
  • ¥100 如何用js写一个游戏云存档