public Result userDashboard( @PathParam("email") String email, @PathParam("id") Integer id, Context context) { Result result = Results.html(); result.render("id", Integer.toString(id)); result.render("email", email); return result; }
--
You received this message because you are subscribed to a topic in the Google Groups "ninja-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ninja-framework/RZ8skgQyo04/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ninja-framewo...@googlegroups.com.
To post to this group, send email to ninja-f...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ninja-framework/52a8a57a-8dcb-4fec-b4bb-41acef1c41dd%40googlegroups.com.
public class ApplicationController {
public Result index() throws Exception{
Result result = Results.html();result.render("tester", new Tester("xxxx", "yyy"));result.render("simpleValue", "simple");return result;
}
static class Tester {
String name;
String code;
public Tester(String name, String code) {
this.name = name;
this.code = code;
}
public String getName() {
return name;
}
public String getCode() {
return code;
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Then my FTL template
<p>
${tester.name}
</p>
>>>>> Error result
FreeMarker template error: The following has evaluated to null or missing: ==> tester.name [in template "views/ApplicationController/index.ftl.html" at line 9, column 46] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like 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 parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${tester.name} auto-escaped [in template "views/ApplicationController/index.ftl.html" at line 9, column 44] ~ Reached through: #nested [in template "views/layout/homeLayout.ftl.html" in macro "myLayout" at line 49, column 9] ~ Reached through: @layout.myLayout "Home page" [in template "views/ApplicationController/index.ftl.html" at line 2, column 1] ----
${simpleValue}
Then it works..
Thanks Alot!
Hans
FreeMarker template error:
An error has occurred when reading existing sub-variable "name"; see cause exception! The type of the containing value was: extended_hash+string (controllers.ApplicationController$Tester wrapped into f.e.b.StringModel)
Caused by: java.lang.IllegalAccessException: Class freemarker.ext.beans.BeanModel can not access a member of class controllers.ApplicationController$Tester with modifiers "public"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109)
FreeMarker template error:
The following has evaluated to null or missing:
==> tester.getName [in template "views/ApplicationController/index.ftl.html" at line 9, column 22]
To view this discussion on the web visit https://groups.google.com/d/msgid/ninja-framework/CACRkZ6LS00w-3VV%2B8wWiXsczUHJK1m8tbz_LuMdwic72FbWXHQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ninja-framework/CACRkZ6KZrpiwCUP%3Dz6ASt-ZH1BM-5sJ4pUF7M4HrBNi1n4acKg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ninja-framework/CACRkZ6KnocQKEHUHVG7y9xfumHS%2B56PcU04a%3Dd6kXgwsvMvzTg%40mail.gmail.com.