Announcement Announcement Module
Collapse
No announcement yet.
Cannot show view-state using poup Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot show view-state using poup

    Hello Spring Webflow-people

    I've been using webflow for a couple of weeks and have found that it's just what I need in terms of a web framework, so thank you very much for the great work!

    I recently discovered the popup functionality which excited me for simple views, for example for a simple confirmation dialog upon object deletion and stuff like that.

    I have a working webflow when I haven't activated the popups, but once I enable the popup attribute in the webflow below, the following error message appears in the popup instead of the view:
    Component to be rendered with id 'usersForm:users:1:j_id36' could not be found.
    And here's the webflow:
    Code:
    <view-state id="selectUser" view="selectUser.jsp">
    	...
    	<transition on="deleteUser" to="deleteUser">
    		<set name="flowScope.user" value="users.selectedRow" />
    	</transition>
    	...
    </view-state>
    
    <view-state id="deleteUser" view="deleteUser.jsp" popup="true">
    	<transition on="confirm" to="selectUser">
    		<evaluate expression="userService.deleteUser(user)" />
    	</transition>
    	...
    </view-state>
    I really don't have a clue what this issue is about. I think it's in the initial view's code because it makes no difference if I replace the "deleteUser" view with a static html page. So here's how the "deleteUser" action is called:
    Code:
    <h:form id="usersForm">
    <h:dataTable id="users" var="u" value="#{users}">
    	...
    	<h:column>
    		<sf:commandLink action="deleteUser">
    			<h:graphicImage value="/images/icon_remove.png"></h:graphicImage>
    		</sf:commandLink>
    	</h:column>
    </h:dataTable>
    </h:form>
    Is this perhaps related to the dataTable? As you can see in the flow xml I'm using a reference to the dataTable's selectedRow variable...

    Any help would be appreciated, thank you very much!

  • #2
    You must have an &lt;on-entry&gt; bit to your popup

    Okay, I have found the solution to this problem in case anyone else encounters it. For any view-state that is rendered as a popup, you MUST DELCARE AN ON-ENTRY SECTION that displays the fragment you want shown. Otherwise, you get the "Component to be rendered with id XXX cannot be found" issue...

    So, for instance, this does NOT WORK - it gives you the "Component to be rendered with id XXX cannot be found" error.

    Code:
    <view-state id="sandbox">
      <transition on="popup" to="askPopup" />
    </view-state>
    
     <view-state id="askPopup" popup="true" >
            <transition on="continue" to="sandbox" />
        </view-state>
    but this code does work :

    Code:
    <view-state id="sandbox">
      <transition on="popup" to="askPopup" />
    </view-state>
    
     <view-state id="askPopup" popup="true" >
        <on-entry>
    	<render fragments="popupForm" />
         </on-entry>
        <transition on="continue" to="sandbox" />
        </view-state>
    (Note that I have <h:form id="popupForm"... inside my askPopup.xhtml which is why I used the fragment name "popupForm" - you'll need to change that to the id of the JSF component that contains your popup content.)

    Comment


    • #3
      A Tip While Using ViewState

      View state maintains data in a page across postbacks. And this data passes in form of hidden field data. There is a certain limitation of this hidden field. If your hidden field will be greater than that specified value, then sometimes firewalls and proxy servers refuse to let your data passes through. And in that case you have to disable your view state .This might cause many problem if you want your data to be passed.

      So to overcome this problem you can do viewstate chunking. This is a process of splitting the data into multiple chunks and putting them into multiple hidden fields, So that there will not be any problem to your data to pass through. This chunking is done by adding "MaxPageStateFieldLength" property in the page tag in web.config file. The default value is -1 which indicates there is no maximum limit of data. You have to give the integer value which indicates the maximum bytes size for a viewstate field.

      <pages maxPageStateFieldLength="20" >

      ...............................

      </pages>



      After verifying the amount of data you may prefer to do viewstate chunking.

      THanks
      Eliza

      Comment

      Working...
      X