Question

I have a problem with the access at the doView() methods. I've made up a portlet using Liferay 6.3 as CMS, ICEFACES 3.3.0 and tomcat 7. I used a liferay-faces-bridge in order to use Icefaces framework in Liferay. For this reason i have setted up the portlet.xml in this way:

<portlet>
            <portlet-name>FinalTest</portlet-name>
            <display-name>FinalTest</display-name>
            <portlet-class>org.portletfaces.bridge.GenericFacesPortlet</portlet-class>
            <init-param>
                <name>javax.portlet.faces.defaultViewId.view</name>
                <value>/index.xhtml</value>
            </init-param>
            <expiration-cache>0</expiration-cache>
            <supports>
                <mime-type>text/html</mime-type>
            </supports>
            <portlet-info>
                <title>FinalENELTest</title>
                <short-title>FinalENELTest</short-title>
                <keywords>FinalENELTest</keywords>
            </portlet-info>
            <security-role-ref>
                <role-name>administrator</role-name>
            </security-role-ref>
            <security-role-ref>
                <role-name>guest</role-name>
            </security-role-ref>
            <security-role-ref>
                <role-name>power-user</role-name>
            </security-role-ref>
            <security-role-ref>
                <role-name>user</role-name>
            </security-role-ref>
        </portlet>

Also I have a ManagedBean like this (for the business logic):

@ManagedBean(name="backingBean")
@SessionScoped
public class BackingBeanImpl extends GenericPortlet{ 

          .... 

    @Override
protected void doView(RenderRequest request, RenderResponse response)
        throws PortletException, IOException {
    // TODO Auto-generated method stub
    System.out.println("I'M HERE");
    super.doView(request, response);
}

}

The problem is that when the portlet starts the doView() method is not invoked. Maybe it is a bridge problem. I don't know.

I hope someone can help me.

Thanks

Was it helpful?

Solution

Your portlet implementation - according to the portlet.xml that you list - is org.portletfaces.bridge.GenericFacesPortlet. Just because your backing bean implements GenericPortlet does not make it the portlet's implementation. doView is implemented in the referenced portlet, not in your class.

If you want to override GenericPortlet methods, you shouldn't use JSF. Corollary of that: If you use JSF, use the JSF style controllers to access your business logic.

By the way: You shouldn't put your business logic into a portlet, rather make the portlet access your business logic. Don't have your business logic reference the portlet api: That would restrict your business logic to run only in that environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top