SpringMVC(9):JSP报错:#{...} is not allowed in template text

来源:互联网 发布:杭州投融界网络靠谱吗 编辑:程序博客网 时间:2024/04/30 19:41

今天在编写一个structs的小程序时,突然出现了 #{...} is not allowed in template text这个错误,

部分源码如下

[html] view plain copy
  1. <head>  
  2. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
  3. <title>Insert title here</title>  
  4. </head>  
  5. <body>  
  6. <h1>Article add Login user can access</h1>  
  7. 登录用户为:#{loginUser }  
  8. </body>  
  9. </html>  
错误信息:

[html] view plain copy
  1. org.apache.jasper.JasperException: /WEB-INF/Article/add.jsp (line: 12, column: 8) #{...} is not allowed in template text  
  2.     at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)  

查找信息后,在stackfloverflaw网站上,给出了明确的解答

这是原问题链接点击打开链接

原来${...}是jsp的一种标记语言,而#{...}是JSF的一种标记语言,在jsp页面中打印model attribute 必须用${...}





阅读全文
0 0
原创粉丝点击