velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeich...@optonline.net
Subject Ifnotnull
Date Thu, 05 May 2005 21:00:14 GMT

Hey all,

I had previously upgraded to 1.5-dev and things are working well with the one email templating
thing I had found help here on.

Since the upgrade, however, I seem to be getting some RHS of #set statement is null. things
i don't remember getting before.

I explored a bit and found:  http://wiki.apache.org/jakarta-velocity/CheckingForNull

I added these to my velocity property file:
       userdirective = org.apache.velocity.tools.generic.directive.Ifnull
       userdirective = org.apache.velocity.tools.generic.directive.Ifnotnull

And changed my template code as follows:
         #ifnotnull( $form )
             #set ($attr = $form.getBean())
         #end

And get this error:

Encountered "#end\r\n" at line 3, column 1. Was expecting one of: "(" ... ... ... ... "\\\\"
... "\\" ... ... ... "*#" ... "*#" ... ... ... ... ... ... ... ... ... ... ... "{" ... "}"
... 

org.apache.velocity.exception.ParseErrorException: Encountered "#end\r\n" at line 3, column
1.
Was expecting one of:
     
    "(" ...
     ...
     ...
     ...
    "\\\\" ...
    "\\" ...
     ...
     ...
    "*#" ...
    "*#" ...
     ...
     ...
     ...
     ...
     ...
     ...
     ...
     ...
     ...
     ...
    "{" ...
    "}" ...
    
	at org.apache.velocity.Template.process(Template.java:141)
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:428)
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
	at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:835)
	at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:817)
	at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:504)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.getTemplate(Unknown Source)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.handleRequest(Unknown Source)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(Unknown Source)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doPost(Unknown Source)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
	at org.apache.velocity.tools.view.ImportSupport.acquireString(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.doInsert(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.doInsert(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.processUrl(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.processAsDefinitionOrURL(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.processObjectValue(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.get(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecutor.java:65)
	at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:300)
	at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:157)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:224)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:231)
	at org.apache.velocity.Template.merge(Template.java:256)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.mergeTemplate(Unknown Source)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(Unknown Source)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doPost(Unknown Source)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
	at org.apache.velocity.tools.view.ImportSupport.acquireString(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.doInsert(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.doInsert(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.processDefinition(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.processAsDefinitionOrURL(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.processObjectValue(Unknown Source)
	at org.apache.velocity.tools.struts.TilesTool.get(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecutor.java:65)
	at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:300)
	at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:157)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:224)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:231)
	at org.apache.velocity.Template.merge(Template.java:256)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.mergeTemplate(Unknown Source)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(Unknown Source)
	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doPost(Unknown Source)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
	at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
	at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
	at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:237)
	at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:300)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:188)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:534)






---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message