Home > Web Front-end > JS Tutorial > body text

return steering method

巴扎黑
Release: 2016-12-06 11:26:10
Original
1353 people have browsed it

Return steering method
> When using redirect, you need to traverse the last method
@RequestMapping(value = "list")
public String list(HttpServletRequest request,HttpServletResponse response,
                                                     , String> paramMap,
                      Model model) {                    directionService.findPageQuery(request, response, paramMap, model); model.addAttribute("page", page) ;
                                                                using using using                    ‐               ‐                                                 - -   ,                                         ;

>return VIEW_PATH + "/direction/studentDirectionConfig"; then directly returns to the page to be jumped (studentDirectionConfig is the page) after passing all the codes in this method.

> Submit with Ajax:
Step 1: Ajax submits the data to the servlet and undergoes related processing
Step 2: After the servlet, you can return msg data to the front desk through the following method: String msg= "error"; response .getWriter (). Write (msg);
Return information! (If you want to jump to the third part, otherwise the returned information will be processed accordingly, such as the pop-up prompt box in this example.)
The third part: Realize page jump through js in the foreground (if it is placed in jsp in web-inf, jsp must be deployed in web.xml, such a url will be effective, refer to: http://blog.csdn.net/wanghaiping1993/article/details/23510411 about jsp in web-inf Visit) window.location.href="${pageContext.request.contextPath}/main.jsp";

Submit the form using Ajax:
Step 1: After writing the form, submit the information to the servlet
Part 2: Use the following statement to redirect to achieve page jump (used in this way, jsp does not need to be deployed in web-inf)
request.getRequestDispatcher("/WEB-INF/ jsp/***. jsp").forward(request, response);
Example:

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!