Where to declare java references: portlet.java or portletDef


I would like to know what is the difference between the two java files.

portlet.java and portletDefault.java.

Every Portlet Application can contain 0 to N portlets
Every Portlet can contain 0 to Views

For every Portlet Application, Portlet and Portlet View there is an associated Managed Bean.

So you’re question can be restated as:
When adding custom Properties to my Portlet Application, should i add the property to the PageBean or the PortletBean?

There really isn’t too much difference, but i would recommend adding the property to the PageBean if it is only going to be accessed by that one bean.

BTW: The scope for all of those beans can be explored by looking at the Managed Bean tab of the Faces Config Editor.