Announcement Announcement Module
Collapse
No announcement yet.
Issues in AJAX events in Spring Web Flow2 with JSF1.2 + Icefaces1.7 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issues in AJAX events in Spring Web Flow2 with JSF1.2 + Icefaces1.7

    We are evaluating spring web flow2.0 + JSF1.2 + Icefaces 1.7 for a new project. We were able to set up and configure a sample project with help of sample projects available on net.
    We had the additional complexity since we wanted to use Visual JSF drag and drop feature which comes bundled with Netbeans IDE. The limitation of using Visual JSF is that it allows usage of only .jsp and .jspf files. So we decided not to use facelets which have default extension of .xhtml

    Now coming to the problem we are facing.

    One of the component in our pages Tabbed Panel set, do partial page submit, when user clicks on tab pane to select another tab, there is no action event associated with it and there is nothing in flow definition xml to handle it. Now when user selects the other tab, page is submitted and re-rendered but all the styles associated with tabbed panel component are lost. Following is the error trace at the server:

    15:27:42,428 ERROR [OutputStyleRenderer] Error in OutputStyleRenderer
    java.lang.IllegalArgumentException: path cannot be null
    at com.icesoft.faces.application.D2DViewHandler.getRe sourceURL(D2DViewHandler.java:372)
    at org.springframework.faces.webflow.FlowViewHandler. getResourceURL(FlowViewHandler.java:88)
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl. getResourceURL(ViewHandlerImpl.java:222)
    at com.icesoft.faces.renderkit.dom_html_basic.DomBasi cRenderer.getResourceURL(DomBasicRenderer.java:795 )
    at com.icesoft.faces.component.style.OutputStyleRende rer.encodeEnd(OutputStyleRenderer.java:86)
    at javax.faces.component.UIComponentBase.encodeEnd(UI ComponentBase.java:836)
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:580)
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:575)
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:575)
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:575)
    at com.icesoft.faces.application.D2DViewHandler.rende rResponse(D2DViewHandler.java:551)
    at com.icesoft.faces.application.D2DViewHandler.rende rView(D2DViewHandler.java:159)
    at org.springframework.faces.webflow.FlowViewHandler. renderView(FlowViewHandler.java:92)
    at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl. renderView(ViewHandlerImpl.java:283)
    at org.springframework.faces.webflow.JsfView.render(J sfView.java:94)
    at org.springframework.webflow.engine.ViewState.rende r(ViewState.java:245)
    at org.springframework.webflow.engine.ViewState.resum e(ViewState.java:204)
    at org.springframework.webflow.engine.Flow.resume(Flo w.java:545)
    at org.springframework.webflow.engine.impl.FlowExecut ionImpl.resume(FlowExecutionImpl.java:262)
    at org.springframework.webflow.executor.FlowExecutorI mpl.resumeExecution(FlowExecutorImpl.java:163)
    at com.icesoft.faces.webapp.http.core.SwfLifecycleExe cutor.apply(SwfLifecycleExecutor.java:58)
    at com.icesoft.faces.webapp.http.core.ReceiveSendUpda tes.renderCycle(ReceiveSendUpdates.java:94)
    at com.icesoft.faces.webapp.http.core.ReceiveSendUpda tes.service(ReceiveSendUpdates.java:54)
    at com.icesoft.faces.webapp.http.core.RequestVerifier .service(RequestVerifier.java:26)
    at com.icesoft.faces.webapp.http.common.standard.Path DispatcherServer.service(PathDispatcherServer.java :24)
    at com.icesoft.faces.webapp.http.servlet.MainSessionB oundServlet.service(MainSessionBoundServlet.java:1 60)
    at com.icesoft.faces.webapp.http.servlet.SessionDispa tcher$1.service(SessionDispatcher.java:38)
    at com.icesoft.faces.webapp.http.servlet.ThreadBlocki ngAdaptingServlet.service(ThreadBlockingAdaptingSe rvlet.java:19)
    at com.icesoft.faces.webapp.http.servlet.EnvironmentA daptingServlet.service(EnvironmentAdaptingServlet. java:63)
    at com.icesoft.faces.webapp.http.servlet.SessionDispa tcher.service(SessionDispatcher.java:55)
    at com.icesoft.faces.webapp.http.servlet.SessionVerif ier.service(SessionVerifier.java:19)
    at com.icesoft.faces.webapp.http.servlet.PathDispatch er.service(PathDispatcher.java:23)
    at com.icesoft.faces.webapp.http.servlet.MainServlet. service(MainServlet.java:91)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.s ervice(BlockingServlet.java:56)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:179)
    at org.jboss.web.tomcat.security.JaccContextValve.inv oke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionV alve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.authenticator.SingleSignOn.inv oke(SingleSignOn.java:393)
    at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)

    The page is displayed properly for a new request or on page refresh.
    This is a showstopper for us and idea of using SWF is now on hold till we resolve this issue.
    Any help in this regard will be highly appreciated.

    Thanks

  • #2
    I am facing a similar issue. I am confronted with two choices:

    1) Try to rectify why the style disappears (No success so far). I know that the "href" of the ice:outputStyle component is null, which is causing the problem, but i have no clue on how to solve it.

    2) Is it a good idea to somehow hook up tab change event with Web Flow?
    To do this, probably we need to write some custom component so that we can have the action attribute and hook up with webflow. But is it a good way to go about it?

    Another peculiar problem I have is as follows:
    I also have a reset button on that page, which I have hooked with webflow and it renders the same page. As long as I DONOT press the reset button, I can go about changing the tabs. The tabs appear, but without Styles.

    Once I press the reset button, and then try to change tabs, IT DOES NOT WORK. As per the logs, I find that even on tab change it goes to the reset action method, defined in the webflow....!!!!

    Now how do I get over this?!?

    Need urgent help!!!

    Comment


    • #3
      Please test with ICEfaces-1.8RC1: changes have been made to getResourceURL() that may fix this.

      Comment


      • #4
        Thanks Ted...It is really motivating to get a response from you.

        I have tested it with 1.8 release and it's still not resolved.
        I dug deeper into problem and found that there are infact 2 problems:

        1) The first problem seems to be with spring web flow. When user clicks on tabset to change active tab. There is no action event associted, but what we found that SWF2.0 associates previously fired event which was successfully processed in previous request.
        Suppose I have a 2 pages application, first page contains a submit button with say action = "Page2"
        This action is mapped in flow definition trasition which takes it to Page2.
        I have icefaces PanelTabSet on 2nd Page. Now if I click on tab to change active set, spring workflow tries to find mapping of action event= "Page2", and throws NoMatchingTransitionException exception.

        2) Second problem can be recreated by 1 page application where I have Icefaces PanelTabSet. Now on application startup when the first page is rendered and user clicks on tabset to change active tab, we get OutPutStyle render error ( Please see my first post)
        In this case it finds old view but can not get style associated with components. On debugging OutputStyle renderer I found that in class OutputStyleRenderer String href is null.

        As mentioned previously, this problem in only in case of postbacks. It works fine for new requests.

        Comment


        • #5
          Let me illustrate the problem further with some code examples which I have built at my end:

          TestJsp1.jsp
          This is the first page to be loaded. Just has a submit button.
          Code:
          <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ice="http://www.icesoft.com/icefaces/component">
              <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
              <f:view>
                      <html id="outputHtml1">
                          <head id="outputHead1">
                              <ice:outputStyle id="outputStyle1" href="./resources/stylesheet.css"/>
                              <ice:outputStyle id="outputStyle2" href="./xmlhttp/css/xp/xp.css"/>
                          </head>
                          <body id="outputBody1" style="-rave-layout: grid">
                              <ice:form id="form1">
                                  <ice:commandButton value="submit" action="submit"/>
                              </ice:form>
                          </body>
                      </html>
              </f:view>
          </jsp:root>

          TestJsp2.jsp
          This page is rendered when we press submit on the previous page. It has a tab panel with 3 tabs.
          Code:
          <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:jsp="http://java.sun.com/JSP/Page">
              <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
              <f:view>
                  <html id="outputHtml1">
                      <head id="outputHead1">
                          <link href="/xmlhttp/css/xp/xp.css" rel="stylesheet" type="text/css" />
                      </head>
                      <body id="outputBody1" style="-rave-layout: grid">
                          <ice:form id="form1">
                              <ice:panelTabSet partialSubmit="false" id="panelTabSet1" selectedIndex="0" style="left: 264px; top: 96px; position: absolute" tabPlacement="Top">
                                  <ice:panelTab id="panelTab1" label="Tab1">
                                      <ice:panelLayout id="panelLayout1" style="width: 126; height: 122;">
                                          <ice:outputText id="outputText1" value=" Jsp4Tab1"/>
                                      </ice:panelLayout>
                                  </ice:panelTab>
                                  <ice:panelTab id="panelTab2" label="Tab2">
                                      <ice:panelLayout id="panelLayout2" style="width: 126; height: 122;">
                                          <ice:outputText id="outputText2" value=" Jsp4Tab2"/>
                                      </ice:panelLayout>
                                  </ice:panelTab>
                                  <ice:panelTab id="panelTab3" label="Tab3">
                                      <ice:panelLayout id="panelLayout3" style="width: 126; height: 122;">
                                          <ice:outputText id="outputText3" value=" Jsp4Tab3"/>
                                      </ice:panelLayout>
                                  </ice:panelTab>
                              </ice:panelTabSet>
                          </ice:form>
                      </body>
                  </html>
              </f:view>
          </jsp:root>

          main-flow.xml
          Code:
              <view-state id="first" view="/jsp/testFlow/TestPage1.jsp">
                  <transition on="submit" to="page">
                  </transition>
          	</view-state>
              
              <view-state id="page" view="/jsp/testFlow/TestPage2.jsp">
                  <transition on="tab" to="page">
                      <evaluate expression="searchFlow.testMe()"/>
                  </transition>
          	</view-state>
          Now what happens is as follows. Once I press submit on page 1 and land on page 2, webflow has the event key maintained as "submit". Ideally, when I change tabs on page 2, webflow must not be invoked. But somehow, webflow is getting invoked and the event key is still "submit". So I get the exception:
          org.springframework.webflow.engine.NoMatchingTrans itionException: No transition found on occurence of event 'submit' in state 'page' of flow 'main' -- valid transitional criteria are array<TransitionCriteria>[tab] -- likely programmer error, check the set of TransitionCriteria for this state



          If I play a trick and write my main-flow.xml as follows, I do not get the above exception on tab change:

          main-flow.xml
          Code:
              <view-state id="first" view="/jsp/testFlow/TestPage1.jsp">
                  <transition on="submit" to="page">
                  </transition>
          	</view-state>
              
              <view-state id="page" view="/jsp/testFlow/TestPage2.jsp">
                  <transition on="submit" to="page">
                      <evaluate expression="searchFlow.testMe()"/>
                  </transition>
          	</view-state>
          Now, as the event key is still "submit", which can be found on the view state of TestPage2, the flow simply goes to evaluate the expression testMe().


          Practical implications:
          On the second page which has tabs, I can go about changing tabs and it would work fine. But suppose there is a RESET button on the page which clears the fields on that page, it would go through webflow and set the event key as "reset". If I try to change tabs now, the webflow will always look for the "reset" event key and call the reset method defined in the backing beans on click of tabs. This is not acceptable!!

          Another important observation is that when I use FACELETS as the view, instead of JSP, I DO NOT get this problem. That is, the previous event key does not affect the tab change behavior. I can change tabs properly, even after pressing a reset button.

          I would request you to look into this issue and let me know how to go about it.

          Lastly: as a work around to the style issue, I am using:
          <link href="/xmlhttp/css/xp/xp.css" rel="stylesheet" type="text/css" />

          instead of the ice:outputStyle component. This works fine!!

          Comment


          • #6
            It's fixed in 1.8 release

            Comment

            Working...
            X