Announcement Announcement Module
Collapse
No announcement yet.
render fragment Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • render fragment

    Hi all

    I need to render the error as a fragment in flow. what do i need to update in the jsp so that only the error div get updated.

    do i need to make any ajax type calls or spring automatically takes care of that, if i use render fragments inside the flow.

    Thanks
    Thomas

  • #2
    Let me know if following code from web flow sample is of help to you? Or if you are looking for something else?

    Code:
    	<ui:fragment id="hotelSearchFragment">
    		<div id="hotelSearch" class="section">
    		    <span class="errors">
    		       <h:messages globalOnly="true" />
    		    </span>
    			<h2>Search Hotels</h2>
    			<h:form id="mainForm">
    				<fieldset>
    					<div class="field">
    						<div class="label">
    							<h:outputLabel for="searchString">Search String:</h:outputLabel>
    						</div>
    						<div class="input">
    							<sf:clientTextValidator promptMessage="Search hotels by name, address, city, or zip.">
    								<h:inputText id="searchString" value="#{searchCriteria.searchString}" />
    							</sf:clientTextValidator>
    						</div>
    					</div>
    					<div class="field">
    						<div class="label">
    						   	<h:outputLabel for="pageSize">Maximum results:</h:outputLabel>
    						</div>
    						<div class="input">
    							<h:selectOneMenu id="pageSize" value="#{searchCriteria.pageSize}">
    								<f:selectItems value="#{referenceData.pageSizeOptions}" />
    							</h:selectOneMenu>
    				   		</div>
    					</div>
    					<div class="buttonGroup">
    						<sf:commandButton id="findHotels" value="Find Hotels" processIds="*" action="search" />
    					</div>
    			    </fieldset>
    			</h:form>			  
    		</div>
    	</ui:fragment>

    Comment


    • #3
      Hi

      Thanks for that, I am a bit new to the spring framework. Can you also tell me how the JSP gets updated on submit.Is it refreshing the entire page or just the error fragment. If it is just the fragment how to make the submit and how the server returns the fragment back. ie is it using the submit button or javascript /ajax calls .

      I was thinking

      Code:
      <transition on="find" validate="true">
          		<evaluate expression="searchDirectoryAction.searchDirectory(searchDirectoryForm, flowScope.customer, relationshipCustomer, messageContext)" />
          		<render fragments="searchDirectoryResults"></render>
          	</transition>
      will do it but dont know how to update just this fragment from JSP .

      Thanks
      Thomas

      Comment


      • #4
        I've typically used SWF with JSF, so my experience is a bit different.

        Rather than rely on other validation patterns, I explicitly called validation methods with the evaluate action within transitions. I had to put my render fragments for the error section at the very top though, above my validation calls, otherwise it wouldn't execute (since failing a validation method would cancel the transition and any successive actions.

        Not quite sure how this works using the validate attribute and other validation patterns,though.

        Comment


        • #5
          thanks for that , can you paste some code to show how u render fragments.

          All i know is that JSF follows component based paradigm , but fragment rendering should behave same in both i suppose.

          also in your rendering does the entire page is send back or just that fragment. If just the fragment how you update it on the client side.

          cheers
          Thomas

          Comment


          • #6
            If you're using JSF, you'll need to use the Spring Faces (sf) tags. So either an sf: commandButton, an sf: commandLink, or other tags.

            If you're using Spring MVC, you'll need to use Spring Javascript to decorate your controls.

            You have additional options for other libraries, like Trinidad or Richfaces (check the reference guide).

            In either case, using these special tags or decorations handles making the AJAX call and updating the fragments.

            Comment


            • #7
              I am trying to get partial rendering to work for one major reason. I am using style overlay and when i try to reload the entire page with error i am loosing the overlay style. (using http://jquery.com/demo/thickbox/ for overlay)

              so i need some logic to update just the error div in case of an error on validation. if no error the flow should carry on with transition to the success page

              is there some place i can read more about

              Code:
              <render fragments="what goes here"></render>
              and how does it work in a web flow any examples of using it.

              thanks
              Thomas

              Comment

              Working...
              X