Hi Paul,
Exactly - you would perform your business logic in the execute() method, and
keep anything you need to display around, typically by storing it to fields in
the class. So your model class might look something like:
class MyModel ... {
List<Person> personList = null;
public String execute(){
...
personList = loadPersonsBySOAPCall();
...
}
public List<Person> getPersonList() { return personList; }
}
In freemarker, you can now do things like the following:
[if model.personList?has_content]
[#list model.personList as person]
Name: ${person.name!"no name"}<br/>
Age: ${person.age!"no age" }
<hr/>
[/#list]
[#else]
No people were loaded!
[/#if]
How this looks depends a little bit on the shape of your POJOs and how the SOAP
Service was constructed.
The basic idea is that if your model (or the POJOs) have a getter method called
getXyz(), then you can access the value using model.xyz . So you can retrieve
the POJOs via the model, and then retrieve the POJOs fields.
Hope that was clear.
Regards from Vienna,
Richard
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]]
Im Auftrag von Paul Shuttlewood (via Magnolia Forums)
Gesendet: Montag, 06. August 2012 14:23
An: Magnolia User List
Betreff: [magnolia-user] Re: How to design Magnolia to retrieve/set external
data
Hi Richard,
If my model classes extend RenderingModelImpl, then I assume I perform my
business logic in the execute() method. For me this is obtaining (or
nagivating) my POJO model. But how do I access my POJO model from my freemarker
script? I.e. the POJO model will have a list of persons, one specific script
may want to list the first name and surname of each person on a seperate line.
Regards,
Paul
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=2e16ec5c-2be3-4d9a-b79d-f6df9f2bc0bd
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------