I’m calling render() with a few arguments, the first of which is a String argument that I got as a parameter:
public static void action(String url) {
…
render(url,…);
}
I’m getting this error:
The template http://the.contents.of/urlParameter does not exist.
Now, I’m debugging through render(), where I see this snippet:
protected static void render(Object... args) {
String templateName = null;
if (args.length > 0 && args[0] instanceof String && LocalVariablesNamesTracer.getAllLocalVariableNames(args[0]).isEmpty()) {
// I'm getting into this branch
templateName = args[0].toString();
} else {
templateName = template();
}
renderTemplate(templateName, args);
}
What is the if trying to accomplish? Why am I getting into it – is it because I’m not using a local variable for url? Is this documented? What’s the reasoning here?
I’m using version 1.2.x-c40cf37 (that’s somewhere after 1.2.4).
If you provide a string as the first argument, then it assumes that it is the name of the template to render.
Example:
That will render the password-template and pass the url variable to it.
In your case you could do something like this instead:
EDIT:
As an alternative you could also do something like this:
Hope it helps.