Hi all,
I am trying a very simple struts2 (2.1.6) application using velocity (1.6.2 and tools 2.0 beta4) ,
It's nothing more than a simple form with a single textfield.
The code follows
## Velocity Template.
<html>
<head>
<title>Struts2 and velocity </title>
</head>
<body>
pass this message:
$sform("action=Amma" "validate=true")
$stextfield ("label=message" "name=userName" "size=20")
$ssubmit ("label=pass it")
#end
</body>
</html>
when I call this velocity file I get the following error
java.lang.RuntimeException: org.apache.velocity.exception.ParseErrorException: Encountered "#end\n" at /velocityArea/ammaMessage.vm[line 24, column 5]
Was expecting one of:
<EOF>
"(" ...
<RPAREN> ...
<ESCAPE_DIRECTIVE> ...
<SET_DIRECTIVE> ...
"##" ...
"\\\\" ...
"\\" ...
<TEXT> ...
"*#" ...
"*#" ...
<STRING_LITERAL> ...
<IF_DIRECTIVE> ...
<STOP_DIRECTIVE> ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<WORD> ...
<BRACKETED_WORD> ...
<IDENTIFIER> ...
<DOT> ...
"{" ...
"}" ...
at org.apache.velocity.tools.view.VelocityView.getTemplate(VelocityView.java:858)
at org.apache.velocity.tools.view.VelocityView.getTemplate(VelocityView.java:809)
at org.apache.velocity.tools.view.VelocityViewServlet.getTemplate(VelocityViewServlet.java:287)
at org.apache.velocity.tools.view.VelocityViewServlet.handleRequest(VelocityViewServlet.java:248)
at org.apache.velocity.tools.view.VelocityViewServlet.doRequest(VelocityViewServlet.java:215)
at org.apache.velocity.tools.view.VelocityViewServlet.doGet(VelocityViewServlet.java:181)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.velocity.exception.ParseErrorException: Encountered "#end\n" at /velocityArea/ammaMessage.vm[line 24, column 5]
Was expecting one of:
<EOF>
"(" ...
<RPAREN> ...
<ESCAPE_DIRECTIVE> ...
<SET_DIRECTIVE> ...
"##" ...
"\\\\" ...
"\\" ...
<TEXT> ...
"*#" ...
"*#" ...
<STRING_LITERAL> ...
<IF_DIRECTIVE> ...
<STOP_DIRECTIVE> ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<WORD> ...
<BRACKETED_WORD> ...
<IDENTIFIER> ...
<DOT> ...
"{" ...
"}" ...
at org.apache.velocity.Template.process(Template.java:141)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400)
at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:422)
at org.apache.velocity.tools.view.VelocityView.getTemplate(VelocityView.java:853)
... 22 more
It seems the problem is near
#end
tag ,
but I don't know how to solve this, waiting for your reply..
regards