zoukankan      html  css  js  c++  java
  • spring mvc redirect设置FlashAttribute

    在Controller中设置:

        @RequestMapping("/redir")
        public String redir(Model model, RedirectAttributes ra) {
            ra.addFlashAttribute("test", "测试数据");
            return "redirect:/user/users";
        }

    在jsp中使用el表达式接收:

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://"
                + request.getServerName() + ":" + request.getServerPort()
                + path + "/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>">
    
    <title>用户列表</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <link rel="stylesheet" type="text/css" href="<%=basePath %>resources/css/main.css">
    </head>
    
    <body>
         ${test }
        <br />
         
    </body>
    </html>
  • 相关阅读:
    startup毕业论文
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    install
    逻辑卷(lv)管理(LVM)
    mke2fs
    cat & 文件结束符
  • 原文地址:https://www.cnblogs.com/stono/p/4514100.html
Copyright © 2011-2022 走看看