- Create a simple model (javabean class) to pass the value to the template, in the class create a method to return a Map containing the values needed, the keys used to store the values are the keys that will be accessed in the template.
- Register the class as a managed bean in WEB-INF/faces-config-custom.xml (pasting the content here is a bit difficult, until I know how to easily paste an xml content to the post I might not post it). Actually it's not that difficult to register a managed bean, just look at the sample in faces-config-beans.xml.
- Use the bean name as the model passed to the template.
- Access the value in the template, just like the way default values provided by alfresco are accessed.
public Map getTemplateModel() {
Map result = new HashMap();
result.put("sessionId", getSessionId());
return result;
}
<managed-bean>
<description>
Helper bean providing access to http servlet request's related properties
and many other things.
</description>
<managed-bean-name>SanzModel</managed-bean-name>
<managed-bean-class>com.sanz.model.TemplateModel</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<r:template template="/alfresco/templates/elnusa/elnusa.html.ftl" model="#{Elnusa.templateModel}"/>
That's all, I guess I have to sleep now, already late...
Reference :
1 comment:
Hi Santoso,
I am new to the alfresco,me using Alfresco 2.1 version. I read u r documentation about How to create a custom dashlet in Alfresco and i tried it i got successfully.
Now i want to shoe some data on the Dashlets.But i don't know how.
Can you give me a tip please.
Post a Comment