Spring MVC模型未显示字符串

Spring MVC模型未显示字符串,spring,jsp,spring-mvc,el,Spring,Jsp,Spring Mvc,El,我的项目是让最终用户登录,然后转到另一个页面显示消息。如果登录详细信息错误,则会显示相应的错误消息,并给他们再次登录的机会。问题是要显示的消息没有显示。相反,所有正在显示的是 Message is: ${message} index.jsp <form action="login.html" method="post"> Name: <input type="text" name="name"/> Password: <input type="pa

我的项目是让最终用户登录,然后转到另一个页面显示消息。如果登录详细信息错误,则会显示相应的错误消息,并给他们再次登录的机会。问题是要显示的消息没有显示。相反,所有正在显示的是

Message is: ${message}
index.jsp

<form action="login.html" method="post">
    Name: <input type="text" name="name"/>
    Password: <input type="password" name="password"/>
    <input type="submit" value="submit"/>
</form>
web.xml

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
  <servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>*.html</url-pattern>
  </servlet-mapping>
</web-app>

春天
org.springframework.web.servlet.DispatcherServlet
1.
春天
*.html
spring-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    xmlns:p="http://www.springframework.org/schema/p"  
    xmlns:context="http://www.springframework.org/schema/context"  
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
http://www.springframework.org/schema/context  
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:component-scan base-package="com.loginmvc.domain" />
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>
</beans>

您正在
web.xml
文件中使用一个旧描述符。这将导致忽略EL:

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>

确保在JSP中使用:this标记库

和打印消息:
${message}


我强烈建议您使用像eclipse或netbeans这样的IDE,这样可以很容易地检测jsp中的标记库错误和警告。

Hi,我尝试了这个方法,但不幸的是它仍然没有显示字符串。有趣的是,我昨天能够显示字符串。RealRave,你能解决你的问题吗?我也有。而且它也不是上述情况下的适当解决方案。它不是复制品。
<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">
...
</web-app>