欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          java后端如何實(shí)現(xiàn)頁面跳轉(zhuǎn)

          java后端如何實(shí)現(xiàn)頁面跳轉(zhuǎn)

          頁面跳轉(zhuǎn)分類有兩種:重定向和轉(zhuǎn)發(fā),即redirectforward。

          一:重定向redirect

          第一種方式:controller中返回值為String

          相關(guān)免費(fèi)學(xué)習(xí)視頻分享:java在線學(xué)習(xí)

          public String login(HttpServletRequest req, HttpServletResponse resp) return "redirect:http://localhost:8080/index";

          第二種方式:controller中返回值為void

          public void login(HttpServletRequest req, HttpServletResponse resp) resp.sendRedirect("http://localhost:8080/index");

          第三種方式:controller中返回值為ModelAndView

          return new ModelAndView("redirect:/toList");

          二:轉(zhuǎn)發(fā)forward

          例如:

          request.getRequestDispatcher("/student_list.jsp").forward(request, response);

          相關(guān)文章教程推薦:java入門教程

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)