Leundean Leundean wrote:

> If dropping a class in WEB-INF/classes without a package, should the 
> componentClass property simply not be "Car.class” ?

A fully qualified class name does not end with “.class” (see the STK components 
as examples). If the class has no package it should just be “Car”. I’d 
recommend using a package though.

Also, the property is called ‘modelClass’, not ‘componentClass’.

> Anyway, seeing now that it is possible to connect a model to a template. 
> However, this also generates error.
> 
> Is there a tutotial/example available with exact (I think spoonfeeding is 
> necessery on this key thing):
> 
> - POJO contect (java file)
> - Template definition in Config
> - Template (.ftl) with call
> 
> Grateful for this or further advice.

https://documentation.magnolia-cms.com/display/DOCS/Pages#Pages-Properties says:

----
Property: modelClass

Description: Optional. A Java class that contains business logic for the page. 
The model class needs to implement the RenderingModel interface. The renderer 
creates a bean based on the modelClass. Current content, definition and the 
parent model are passed to the constructor. This object is instantiated for 
each rendering of a page or component.

Valid values: Fully-qualified class name. This property needs to be in 
appropriate Magnolia class syntax and specifically refer to the modelClass for 
the page.
----

https://documentation.magnolia-cms.com/display/DOCS/Areas#Areas-Properties 
shows the modelClass property for areas.

https://documentation.magnolia-cms.com/display/DOCS/Components#Components-Properties
 shows the modelClass property is also available for components.

Whether you use the model class for a page, an area or a component, it should 
always implement the RenderingModel interface. You can look at Magnolia’s own 
model classes that implement this interface for examples.

https://documentation.magnolia-cms.com/display/DOCS/Component+definitions#Componentdefinitions-Modelclass
 also has information on working with model classes for components. 

Working with model classes is also explained in the Magnolia Academy (you might 
want to start at the beginning though): 
https://academy.magnolia-cms.com/display/MA/U4+Adding+a+Model+class

Good luck! Once you see how this works, it’s a pretty easy and powerful 
mechanism.

Nils.

----------------------------------------------------------------
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to