AnsweredAssumed Answered

Post Webscript Error

Question asked by riadhazzouz on Apr 1, 2019
Latest reply on Apr 1, 2019 by roberto.gamiz

i wrote a simple post java backed webscript

String user = "admin";
user = req.getParameter("user");

model.put("user", user)
return model;

 

but every time I try it with : curl -X POST "http://localhost:8080/alfresco/s/test/hello.json?user=joey&guest=true"
I get this message error :

FreeMarker template error:
The following has evaluated to null or missing:
==> node [in template "test.post.json.ftl" at line 3, column 22]

Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction (FTL stack trace):
----------
==> ${node} [in template "test.post.json.ftl" at line 3, column 20]
----------

 

this is my test.post.json.ftl file :

 

{"test" :
{
"user" : "${user}"
}
}

Outcomes