I know how to create JSF 2.0 servlets and I know how to create portlets, but I have problems combining both technologies. My JSF portlet works well until I have to call methods of my backing beans via <h:commandLink />
. When I click those links the current page is reloaded and no method is invoked. I think my application needs some extra configuration. What needs to be done in order to get a command link like this to work:
<h:commandLink action="#{backingBean.doSomething}" />
Note that I'm using a WebSphere 8 portal server which provides a JSF 2.0 portlet bridge.
EDIT
I see a basic conflict here:
My managed beans are configured using annotations:
@ManagedBean(name = "backingBean")
@ViewScoped
public class entryEditController
{
public String doSomething()
{
return "result.xhtml";
}
}
This is my faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<view-handler>com.ibm.faces20.portlet.FaceletPortletViewHandler</view-handler>
<el-resolver>com.ibm.faces20.portlet.PortletELResolver</el-resolver>
<resource-handler>com.ibm.faces20.portlet.httpbridge.PortletResourceHandler</resource-handler>
</application>
</faces-config>
If your bean is @SessionScoped
or @ViewScoped
you have to add this to your web.xml:
<context-param>
<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
<param-value>false</param-value>
</context-param>
<h:messages />
to your template