Saturday 31 August 2013

#{...} is not allowed in template text in Spring Web Application

#{...} is not allowed in template text in Spring Web Application

I am new to Spring. I was trying to display a simle message on browser
screen with Spring. But I am getting this error: ..#{...} is not allowed
in template text...
my Java code is:
package Ekle;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class DomainEkleController {
@RequestMapping("/Ekle")
public ModelAndView domainEkle() {
String message = "Hello World, Spring 3.0!";
return new ModelAndView("DomainEkle", "message", message);
}
}
And my JSP is:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h2>#{message}</h2>
</body>
</html>
I am using Eclipse Kepler, Apache Tomcat 7, And Spring Framework 3.2.4 I
opened project as Dynamic web project.
And here is the full logs:
type: Exception report
message: /Ekle/DomainEkle.jsp (line: 9, column: 6) #{...} is not
allowed in template text
description: The server encountered an internal error that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: /Ekle/DomainEkle.jsp (line: 9,
column: 6) #{...} is not allowed in template text
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:103)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:733)
org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:954)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1798)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the
Apache Tomcat/7.0.42 logs.

No comments:

Post a Comment