I have an ActionListener for a JSF button as follows,
<h:commandButton id="id1" action="#{Mybean.Submit}" value="Click">
<f:actionListener binding="#{Mybean.actionListenerImpl}" type="bean.ActionListenerImpl" />
</h:commandButton>
The ActionListener is implemented as follows,
public void processAction(ActionEvent event) throws AbortProcessingException {
FacesContext fc = FacesContext.getCurrentInstance();
HttpServletRequest req = (HttpServletRequest)fc.getExternalContext().getRequest();
PortletBackingContext pbc = PortletBackingContext.getPortletBackingContext(req);
pbc.fireCustomEvent("test", "test");
}
But this is throwing the follwing exception:
java.lang.ClassCastException: com.bea.portlet.container.ActionRequestImpl cannot be cast to javax.servlet.http.HttpServletRequest
at bean.ActionListenerImpl.processAction(ActionListenerImpl.java:18)
I need access to HttpServletRequest to get PortletBackingContext object through which I can fire a custom event.
I am using JSF 1.2 in weblogic 10.3.0
I got HttpServletRequest by accessing “javax.servlet.request of ActionRequest.