Java jsp中的访问请求属性(Spring3MVC)

Java jsp中的访问请求属性(Spring3MVC),java,spring,spring-mvc,Java,Spring,Spring Mvc,iam在spring mvc中使用非常基本的控制器 ... @RequestMapping("/welcome") public ModelAndView helloWorld() { String message = "Hello World, Spring 3.0!"; return new ModelAndView("helloteste", "message", message); } ... 但是当从jsp访问它时,什么也不显示。 波

iam在spring mvc中使用非常基本的控制器

...
@RequestMapping("/welcome")
    public ModelAndView helloWorld() {

        String message = "Hello World, Spring 3.0!";
        return new ModelAndView("helloteste", "message", message);
    }
...
但是当从jsp访问它时,什么也不显示。 波纹管

<html>
<head>
<title>Spring 3.0 MVC Series: Hello World </title>
</head>
<body>
${message}

</body>
</html>
但是,如果我直接从请求的属性中获取te信息,它会工作

<%
String s = (String ) request.getAttribute("message");
out.print(s);

%>

为什么符号${…}不起作用?

似乎JSP没有解析表达式语言。如果web.xml文件没有为标记指定2.4或更高版本属性,则这可能是一个配置问题。在这种情况下,我建议将您的web.xml文件更新为以下内容,前提是您的应用程序服务器足够现代化:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

</web-app>

试过了,没用。仍然在浏览器上获取${model.message}您使用的是什么版本的JSP?好像它不想解决这个问题。在web.xml文件中,web应用程序标记上的版本是什么?None,just-header web.xml必须指定版本2.4或更高版本才能使用JSPEL,看起来您使用的是2.3。按照提供的链接更改web.xml配置。只是好奇,您使用的是什么应用程序服务器?
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

</web-app>