2 Replies Latest reply on Jan 3, 2007 5:44 PM by Brian Weaver

    @Out/@DataModelSelection issues when using s:link but not wi

    Brian Weaver Newbie

      I've run into strange issues when trying to use s:link verses ice:commandLink for performing an action when the selected item is in a dataTable element. I'm just trying to find out if it's a bug or a horrible misunderstanding on my part.

      In a nutshell I have a Session bean with three private member: A list annotated with @DataModel, an item annotated with @DataModelSelection, and another item annotated with @Out(required=false).

      If I use <ice:commandLink action="#{manager.updateItem}" value="#{itemBean.name}"> then SEAM correctly updates the data model selection. I set the @Out member in the updateItem() method and then return a JSF navigation string to a new page. Everything works as expected on the new page and the corresponding manager's @In annotation.

      I was using <s:link action="#{manager.updateItem}" value="#{itemBean.name}">, the method would get invoked but data model selection was always null. The @Out annotated member did not work either, even if I set the value during the updateItem() method with a 'new Item()' value.

      Is the the correct behavior?

        • 1. Re: @Out/@DataModelSelection issues when using s:link but no
          a m Newbie

          definitly not. s:link should work.
          please post your code.

          • 2. Re: @Out/@DataModelSelection issues when using s:link but no
            Brian Weaver Newbie

            Here is the relevant section from the XHTML


            <ice:dataTable value="#{slaBeanList}"
            var="slaBean"
            styleClass="wdgt-data-table"
            columnClasses="wdgt-vert-l, widget-box-body, widget-box-body, wdgt-vert-r"
            rowClasses="odd-row, even-row"
            headerClass="wdgt-header"
            footerClass="wdgt-footer">

            <ice:column>
            <f:facet name="header">
            <ice:graphicImage url="img/spacer.gif" styleClass="wdgt-hdr-l"/>
            </f:facet>
            <f:facet name="footer">
            <ice:graphicImage url="img/spacer.gif" styleClass="wdgt-ftr-l-even"/>
            </f:facet>
            </ice:column>

            <ice:column>
            <f:facet name="header">
            <ice:graphicImage url="img/spacer.gif" styleClass="wdgt-hdr-m"/>
            </f:facet>
            <ice:selectBooleanCheckbox value="#{slaBean.selected}"/>
            <f:facet name="footer">
            <ice:graphicImage url="img/spacer.gif" styleClass="wdgt-ftr-m-even"/>
            </f:facet>
            </ice:column>

            <ice:column>
            <f:facet name="header">
            <ice:commandLink action="#{slaManagerAction.sortByColumnAction}"
            styleClass="widget-box-header-text">

            <ice:graphicImage rendered="#{slaManagerAction.sortBy == 'name'}"
            styleClass="#{(slaManagerAction.ascending == 'true') ? 'wdgt-hdr-sort-up' : 'wdgt-hdr-sort-down'}"
            url="img/spacer.gif"/>
            <ice:outputText value="Name"/>
            <f:param name="sortColumn" value="name"/>

            </ice:commandLink>
            </f:facet>

            <!-- This command link was originally a s:link object, but for some reason the
            - the JSF/ICEfaces/SEAM handling of s:link did now work correctly with the
            - SEAM @DataModel & @DataModelSelection in the slaManagerAction. Not sure
            - what the problem is, but perhaps it will get fixed in the next version
            - after 1.1GA
            -
            - s:xxxx might be working as designed... See the following URL
            -
            - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=95978
            - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98321
            -
            -->
            <ice:commandLink value="#{slaBean.serviceLevelAgreement.name}"
            action="#{slaManagerAction.updateSLA}"/>

            <f:facet name="footer">
            <h:graphicImage url="img/spacer.gif" styleClass="wdgt-ftr-m-even" />
            </f:facet>
            </ice:column>

            <ice:column>
            <f:facet name="header">
            <ice:graphicImage url="img/spacer.gif" styleClass="wdgt-hdr-r" />
            </f:facet>
            <f:facet name="footer">
            <ice:graphicImage url="img/spacer.gif" styleClass="wdgt-ftr-r-even" />
            </f:facet>
            </ice:column>
            </ice:dataTable>


            The relevant portions from the slaManagerAction


            @DataModel(value="slaBeanList")
            private List<ServiceLevelAgreementBean> slaBeanList;

            @DataModelSelection(value="slaBeanList")
            private ServiceLevelAgreementBean selectedBean;

            @SuppressWarnings("unused")
            @Out(required=false, value="SLA")
            private ServiceLevelAgreement sla;

            @Begin(join=true)
            public String updateSLA()
            {
            logger.debug("#updateSLA()");
            logger.debug("SEAM.isConversationContextActive = {0}", Boolean.toString(Contexts.isConversationContextActive()));
            if (selectedBean == null)
            {
            logger.error("No SLA selection was set via the SEAM data model selection, unable to push 'SLA' into context");
            throw new IllegalStateException("No SLA was selected or set by the conversation manager");
            }
            sla = selectedBean.getServiceLevelAgreement();
            return "UpdateSLA"; // JSF Navigation, see WEB-INF/navigation.xml
            }



            I also just verified that if I change the ice:commandLink to s:link in the XHTML it fails badly! Here is the stack trace showing the IllegalStateExceptoin generated from the updateSLA() method.


            2007-01-03 17:36:29,281 ERROR [org.jboss.seam.core.Exceptions] redirecting to debug page
            javax.ejb.EJBException: java.lang.IllegalStateException: No SLA was selected or set by the conversation manager
            at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
            at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
            at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
            at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
            at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
            at $Proxy126.updateSLA(Unknown Source)
            at com.raritan.ccsd.action.sla.ServiceLevelAgreementManager$$FastClassByCGLIB$$54de4ff3.invoke(<generated>)
            at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
            at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
            at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:73)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
            at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
            at sun.reflect.GeneratedMethodAccessor239.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:38)
            at sun.reflect.GeneratedMethodAccessor201.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
            at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
            at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
            at org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:82)
            at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:51)
            at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$538b5327.updateSLA(<generated>)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
            at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:59)
            at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:71)
            at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:98)
            at org.jboss.seam.core.Pages.callAction(Pages.java:398)
            at org.jboss.seam.jsf.AbstractSeamPhaseListener.callPageActions(AbstractSeamPhaseListener.java:253)
            at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:201)
            at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:51)
            at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
            at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
            at com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet.service(PersistentFacesServlet.java:394)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            at java.lang.Thread.run(Thread.java:595)
            Caused by: java.lang.IllegalStateException: No SLA was selected or set by the conversation manager
            at com.raritan.ccsd.action.sla.ServiceLevelAgreementAction.updateSLA(ServiceLevelAgreementAction.java:200)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
            at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
            at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
            at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:51)
            at sun.reflect.GeneratedMethodAccessor205.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:23)
            at sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:51)
            at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:50)
            at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at com.raritan.ccsd.action.interceptor.LoggedInInterceptor.checkLoggedIn(LoggedInInterceptor.java:53)
            at sun.reflect.GeneratedMethodAccessor242.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:39)
            at sun.reflect.GeneratedMethodAccessor241.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
            at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
            at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
            at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
            at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
            at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
            at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:49)
            at sun.reflect.GeneratedMethodAccessor227.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
            at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
            at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
            ... 79 more
            2007-01-03 17:36:29,328 DEBUG [org.jboss.seam.core.Events] Processing event:org.jboss.seam.preSetVariable.org.jboss.seam.debug.lastException