Spring portlet in Control Panel.

2364382, modified 15 Years ago. Liferay Master Posts: 660 Join Date: 3/3/09 Recent Posts
Hi,

Can anyone tell me how to setup a Spring portlet in the Control Panel?
I know I how to setup a Struts base portlet for the control panel, just simply create a class inherit from ControlPanelEntry class and insert it into the liferay-portlet.xml file -- this is for Struts Portlet, how about Spring portlet?

Very appreciate for any suggestion and a simple example will be great too.

Thanks
Sam
3581261, modified 15 Years ago. Junior Member Posts: 82 Join Date: 7/16/09 Recent Posts
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Sample+Spring+Portlet

http://www.blokefood.com/liferay-portal-4.2.1/web/blokefood/

check these.
2364382, modified 15 Years ago. Liferay Master Posts: 660 Join Date: 3/3/09 Recent Posts
kehsihba eejrenab:
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Sample+Spring+Portlet

http://www.blokefood.com/liferay-portal-4.2.1/web/blokefood/

check these.


Thank you very much for the example.
With example in the second link, I understand that:

control-panel-entry-category: The 'category' where your portlet will appear. There are currently 4 valid values for this element: 'my', 'content', 'portal', and 'server'.
control-panel-entry-weight: Determines the relative ordering for your portlet within a given category. The higher the number, the lower in the list your portlet will appear within that category.
control-panel-entry-class: The name of a class that implements the ControlPanelEntry interface which determines who can see the portlet in the control panel via an isVisible method.


But with Spring portlet, how to do you leveraged the control panel and spring protlet configuration in order to add the spring portlet onto the contro panel.

Thanks
Sam
2364382, modified 15 Years ago. Liferay Master Posts: 660 Join Date: 3/3/09 Recent Posts
kehsihba eejrenab:
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Sample+Spring+Portlet

http://www.blokefood.com/liferay-portal-4.2.1/web/blokefood/

check these.


Hi I understand the first link, but not quite understand the second.
Do I have to create a mapping between my ControlPanelEntry class with my Controller class?
To this extend, this is probably not a liferay question, but I still hope someone whom have done this development can explain to me the basic for linking the ControlPanelEntry class with custom defined Spring portlet.

Thank you in advance for any suggestion and help.

Thanks
Sam
2364382, modified 15 Years ago. Liferay Master Posts: 660 Join Date: 3/3/09 Recent Posts
kehsihba eejrenab:
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Sample+Spring+Portlet

http://www.blokefood.com/liferay-portal-4.2.1/web/blokefood/

check these.


I am still not able to figure out how this example related to my question?
My original question is "how to add a Spring portlet into Control Panel", rather than "how to write a Spring portlet for liferay"

Thanks
Sam
3581261, modified 15 Years ago. Junior Member Posts: 82 Join Date: 7/16/09 Recent Posts
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Control%20Panel
check once
2364382, modified 15 Years ago. Liferay Master Posts: 660 Join Date: 3/3/09 Recent Posts
I think I should put the following code in my name-portlet.xml file:



    <!-- Handler Mapping -->
                                                                                                        
        <bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
                <property name="portletModeMap">
                        <map>
                                <entry key="view"><ref bean="helloWorldPortlet" /></entry>
                        </map>
                </property>
        </bean>
                                                                                                        
        <!-- Exceptions Handler -->
                                                                                                        
        <bean id="defaultExceptionHandler" parent="defaultExceptionHandlerTemplate" />
 


But the eclipse editor complains,

The value 'portletModeHandlerMapping' of attribute 'id' on element 'bean' is not valid 
 with respect to its type, 'ID'.


Should I ignore this error?

Thanks
Sam
thumbnail
365642, modified 15 Years ago. Expert Posts: 297 Join Date: 1/3/08 Recent Posts
Hi,

You need to override the ControlPanelEntry interface only when you want to change the permissions to whom your portlet is visible.

Otherwise just having these entries in your liferay-portlet.xml is sufficient.

<control-panel-entry-category>content</control-panel-entry-category>
<control-panel-entry-weight>1.5</control-panel-entry-weight>


Regards,
Tina