Skip to content

'url' property of model class 'project.java' leads to Error: following has evaluated to null or missing.  #8

@andrematzke

Description

@andrematzke

Hi,

in the Samples in
samples/fr.opensagres.xdocreport.samples.docxandfreemarker

there you can find for the for the context model a class called Project.java. In that class the constructor has to be filled with a parameter "name". There is also defined as a property of the class something called "url" with a get/set - ter.

Conveniently there is no sample-duo (docx, java), which uses this URL.

I tried using that URL property e.g. :
with a $(project.url) in the docx-file and

Project project = new Project("XDocReport");
project.setURL = "www.hello-world.de";
context.put("project", project);
report.process(context, out);

then I get this:
2022-02-24 15:55:03.821 ERROR 7584 --- [nio-8081-exec-2] freemarker.runtime : Error executing FreeMarker template freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> project.url [in template "fr.opensagres.xdocreport.document.docx.DocxReport@72879b71!word/document.xml" at line 4, column 9097]

meanwhile I dont put it via a model class into the context, rather than with many calls alá context.put(String key, String value)

Where is the issue ? Do I understand something wrong ? Why is there no example with the "url" from the model class "Project" ? Or for what purpose is there even the "url" property in the model class "project" ?

on my research in the internet over this issue of mine, I have found examples where the coder extended the constructor with all the parameters he wanted to be integrated. But this kind of using a constructor I wouldnt prefer over my many single calls, due to the fact, that a constructor shouldnt look like that...

BR,
A.Emm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions