ActionListener
次のようにJSFボタン用があります。
<h:commandButton id="id1" action="#{Mybean.Submit}" value="Click">
<f:actionListener binding="#{Mybean.actionListenerImpl}" type="bean.ActionListenerImpl" />
</h:commandButton>
はActionListener
次のように実装されます。
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");
}
しかし、これは次の例外をスローしています:
java.lang.ClassCastException: com.bea.portlet.container.ActionRequestImpl cannot be cast to javax.servlet.http.HttpServletRequest
at bean.ActionListenerImpl.processAction(ActionListenerImpl.java:18)
カスタム イベントを発生させることができるオブジェクトHttpServletRequest
を取得するには、にアクセスする必要があります。PortletBackingContext
weblogic 10.3.0 で JSF 1.2 を使用しています。