jsf - Avoid conctructor recall or make it right, how? -
i have absolutely workable portlet. complicated form many popups, lazytables, tables , on. works fine. , want allow autofill fields , structures. add in constructor analizing parameter url:
renderrequest renderrequest = (renderrequest) (facescontext .getcurrentinstance() .getexternalcontext().getrequestmap().get("javax.portlet.request")); string applicationindex = renderrequest.getparameter("caid");
and initializing structures data or default constructors.
when open popup, see them without data or buttons doesn't react on clicking. , in log:
caused by: java.lang.classcastexception: com.liferay.portlet.resourcerequestimpl cannot cast javax.portlet.renderrequest
it occurs @ line:
renderrequest renderrequest = (renderrequest)facescontext.getcurrentinstance).getexternalcontext).getrequestmap).get"java
x.portlet.request"));
it first line of bean constructor.
so question is: how make constructor work correctly in circumstances?
you're casting resourcerequest
, which, in portal world points resource lifecycle phase (e.g. ajax), you're casting renderrequest
, tied render phase.
you might want use portletrequest
, supertype of resourcerequest
of renderrequest
.
Comments
Post a Comment