While most MyFaces apps work seamlessly as a servlet or a portlet, changing a MyFaces appliction into a portlet can sometimes raise issues. There are several circumstances which make it necessary to change sources to get it run. There is also the JIRA entry MYFACES-434 which addresses some of the issues. Shinsuke SUGAYA has done there already a lot work and provides at https://sourceforge.jp/projects/pal/ a MyFaces-bridge (in Japanese).
Any help is welcome to improve the portal support of MyFaces!
There are some issues, which cause the problems of using MyFaces together with portals.
Portal servers provide often caching of the portlets. This could work different than the expected caching provided by a commen web contaienr like Tomcat. One solution could be to disable portlet caching, see http://jroller.com/page/stritti?entry=myfaces_portlets_within_liferay
The Tomahawk Datatable doesn't work with two datascrollers. ERROR [portal-web.docroot.html.portal.render_portlet.jsp] java.lang.IllegalStateException: Duplicate component ID found in view. (Liferay 4.0)
Portlet Bug in MyFaces 1.1.4
There is a bug in 1.1.4 that can cause a NullPointerException. See PortletSerialFactoryWorkaround.
Duplicate IDs are often thrown also during development when some of the jsf-pages are not recompiled completly. Then try to remove all compiled jsp files and it should work again. See also the bullet on Caching
CreatingJSFPortlets - Quick and dirty instructions to turn your MyFaces app into a portlet.
UsingPortletUtil - What to do if your application needs to know whether or not it is running as a portlet.
UsingPortletModes - Make your MyFaces portlet use portlet modes such as Edit and Help.
MavenLiferayPortlet - How to build a MyFaces app with Maven 2 and deploy it under Liferay.
Remote Debugging could be useful if you are using Portals. How to set up Eclipse for remote debugging, have a look at Levent Gurses' great article: http://www.jacoozi.com/index.php?option=com_content&task=view&id=119&Itemid=136 .
How to use Tree2 in portlets has an own section there.
To get user security see also specific chapter at SecurityContext
How to get run MyFaces within portlets on different portal servers (in progress).
JSR-168 Portlet Specification: http://jcp.org/en/jsr/detail?id=168
JSR-286 Portlet 2.0 Specification (in progress): http://jcp.org/en/jsr/detail?id=286
JSR-301 Portlet Bridge Specification for JSF (in progress): http://jcp.org/en/jsr/detail?id=301
Apache Portals Project: http://portals.apache.org
Apache Portals JSF Bridge: http://portals.apache.org/bridges/multiproject/portals-bridges-jsf
Shinsuke SUGAYA's Tomahawk-bridges: http://palab.blogspot.com/2006/12/tomahawk-bridge-09-released.html