cancel
Showing results for 
Search instead for 
Did you mean: 

freemarker.template.SimpleHash error - cm:title

rfischer
Champ in-the-making
Champ in-the-making
I am having an issue with accessing the title field in my ftl.  I use a webscript to find a node and the following line in the ftl  throws a freemarker issue.  The code had worked in previous versions.


<title>${content.properties["cm:title"]}</title>

— error thrown

Expecting a string, date or number here, Expression content.properties["cm:title"] is instead a freemarker.template.SimpleHash'. Please contact your system administrator.
org.alfresco.web.scripts.WebScriptException: 09060004 Wrapped Exception (with status template): 09060003 Error during processing of the template 'Error on line 19, column 24 in foo/get/foo.get.xml.ftl
Expecting a string, date or number here, Expression content.properties["cm:title"] is instead a freemarker.template.SimpleHash'. Please contact your system administrator.
        at org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:613)
        at org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:165)
        at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:357)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:407)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:424)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:288)
        at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:262)
        at org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)
        at org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:122)
        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.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:286)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)

2 REPLIES 2

mikeh
Star Contributor
Star Contributor
Are you sure the property is set? Try

<title>${content.properties["cm:title"]!"No title"}</title>

Mike

rfischer
Champ in-the-making
Champ in-the-making
It is not null and I am able to access it in the webscript.  I then can set it to a variable to use it in the ftl.  This approach is less than ideal because it will force changes in other webscripts too.


model.nodeTitle = model.content.properties["cm:title"];