Saturday, 15 March 2014

jsp - jstl validates c:if on timeout which cause exception -



jsp - jstl validates c:if on timeout which cause exception -

i have page utilize richfaces , jsf , added jstl code validate in bean, code beingness validated when session timeouts, , triggers exception, code :

<c:if test="#{viewercontroller.viewerbean.cancountmessages}" > <td> <a4j:commandbutton value="count" action="#{viewercontroller.docount}" /> </td> </c:if>

so code gets validated , next exception thrown:

/pages/viewer/index.xhtml @43,67 test="#{viewercontroller.viewerbean.cancountmessages}" error occurred performing resource injection on managed bean viewercontroller

is there way prevent c:if tag validated when session not valid

note: viewercontroller class sessionscoped .

i able workaround this, may help having similar issue,

well, have saved variable in session after user login, , queried if variable exist in c:if statement :

when logging user in web app :

facescontext.getcurrentinstance().getexternalcontext().getsessionmap().put("sessionvalid",true);

and added method in viewercontroller class:

boolean issessionvalid(){ homecoming facescontext.getcurrentinstance().getexternalcontext().getsessionmap().get("sessionvalid") != null ; }

and code :

<c:if test="#{viewercontroller.sessionvalid , viewercontroller.viewerbean.cancountmessages}" > <td> <a4j:commandbutton value="count" action="#{viewercontroller.docount}" /> </td> </c:if>

jsp jsf jstl

No comments:

Post a Comment