springmvc用model传值到jsp页面,el表达式引用接收不到传递过来的值,显示仍然为${xxx}

Controller

package com.lx.controller;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author luxin
 * @create 2019-05-20 12:38
 */
@RequestMapping("user")
@Scope("prototype")
@Controller
public class UserController {

    @RequestMapping("ll")
    public String test1(Model model){
        System.out.println("222");
        model.addAttribute("user","user222");
        model.addAttribute("name", "我是Model!!");
        return "hello";

    }
    @RequestMapping("/test3")
    public String testModel(Model model){
        model.addAttribute("message", "上午真困!");
        return "hello";
    }
}

JSP


<%@ page   contentType="text/html;charset=UTF-8" language="java" %>


    
    显示


${name}

${name}

${requestScope.name}

${sessionScope.name}

解决方法


<%@ page  isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>

你可能感兴趣的:(遇到的问题)