Partial Page Rendering using Spring Webflow

UI Components for JSF
ctuck
Posts: 6
Joined: 20 Aug 2009, 23:23

20 Aug 2009, 23:31

Does primefaces partial page rendering work with spring webflow?

If so, does anybody have a working example.

In the PrimeFaces showcase demo there are 2 simple ajax framework examples: "Basic PPR" and "Update Attribute". I can't get either to work with spring webflow.

Your help is appreciated.

Thanks

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

20 Aug 2009, 23:53

Hmm, never used them together. Do you get any errors? Can you trace it with firebug, is the ajax request sent and if so what's the response?

ctuck
Posts: 6
Joined: 20 Aug 2009, 23:23

21 Aug 2009, 00:05

just started using firebug this afternoon. Here is what I see in firebug after clicking the primefaces commandbutton.

Post + url + 200 OK 20ms

Post:
firstname ggg
j_id14 j_id14
j_id18_button j_id18_button
primefacesAjaxRequest true
update display

Response:
<partialResponse><components><component><id>display</id><output><![CDATA[]]></output></component></components><state><![CDATA[]]></state></partialResponse>

I'm not seeing any errors.

Do you see anything wrong here?

Thanks

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

21 Aug 2009, 01:50

The partial output is empty, can you post the related part of your JSF page?

ctuck
Posts: 6
Joined: 20 Aug 2009, 23:23

21 Aug 2009, 17:40

Here is code.

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:sf="http://www.springframework.org/tags/faces"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="layouts/standard.xhtml">

	<ui:define name="content">

<h:form prependId="false">  
     <h:panelGrid columns="2" style="margin-bottom:10px">  
         <h:outputLabel for="firstname" value="Firstname:" />  
         <h:inputText id="firstname" value="#{dashboardBean.message}" /> 
           
         <p:commandButton value="Reset" type="reset"/>  
         <p:commandButton value="Ajax Submit" update="display"/>  
     </h:panelGrid>  
   
     <h:panelGrid id="display" columns="2">  
         <h:outputText value="Firstname:" />  
         <h:outputText value="#{dashboardBean.message}" /> 
     </h:panelGrid>  
</h:form>

	</ui:define>
</ui:composition>

Thank You for your help.

ctuck
Posts: 6
Joined: 20 Aug 2009, 23:23

21 Aug 2009, 19:11

My previously posted code which produced the empty response is a standard view outside of a webflow. When placing that same code inside a flow. I get the response back, however the value I'm expecting from the Partial Page Update is missing.

The RichFaces component library uses a special parameter for it's ajax rerender capability to work with webflow. It looks like this:

"<a4j:commandButton value="ajax" reRender="#{flowRenderFragments}" action="getGreeting" />"

The important part is "#{flowRenderFragments}". The flow definition file rerenders a fragment of the view based on the action param.("getGreeting" in this case).

Does primefaces have a similar construct for integrating its ajax capabilities with spring webflow?

Thanks,
I appreciate your help.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

21 Aug 2009, 20:41

No PrimeFaces doesn't know about the flows of spring webflow, weird I didn't know that you need to place hacks to work with spring webflow. So I guess for you now it sounds like a better idea to go with RichFaces PPR if you say they added hacks to make it work with web flow.

Turjakas
Posts: 48
Joined: 22 Jan 2010, 17:07

22 Jan 2010, 17:16

I think I've almost solved this problem. If I've understood it correctly, the main requirement for Web Flow to work with partial page rendering is an AjaxHandler class implementation, which tells Web Flow whether an incoming HTTP request is an AJAX request.

I've written a simple implementation of an AjaxHandler for PrimeFaces and I can get a proper partialResponse-AJAX response from PrimeFaces when I'm debugging my application with FireBug.

However, there seems to be another problem, which is might be caused by Web Flow, as the AJAX response that I get also contains the corresponding full XHTML document appended to the PrimeFaces partialResponse-document, so that PrimeFaces JavaScript code is not able to parse it (or that's at least what I think the problem is...).

See my post on SpringSource forums for more details: http://forum.springsource.org/showthread.php?t=83567

EDIT:

Some details about how I use Web Flow with PrimeFaces:

It seems that partial page rendering can be done the PrimeFaces way using the update-attribute in JSF components and specifying the component IDs just like you would normally do.

In addition to this, it seems that it is necessary to get rid of any <render fragments="..." /> in the flow definitions as partial page rendering is now handled solely by PrimeFaces and NOT Web Flow,
so the #{flowRenderFragments} related stuff the previous posts talk about is not used here.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

22 Jan 2010, 19:01

I've tried integrating PrimeFaces with SWF but always faced with issues like this actually although I never make it that far as you. :) So if SWF ignores that PrimeFaces has completed JSF lifecycle and still appends to whole document then it might be a problem with SWF integration, I've checked your AjaxHandler and it seems like a correct implementation.

When I had the time, I'm planning to work on improving PrimeFaces-SWF integration.

CannyDuck
Posts: 36
Joined: 27 Apr 2010, 17:26

29 Apr 2010, 17:35

How can a trigger a Web Flow transition event with a PrimeFaces command button?
Is this possible? Otherwise I could not use the command button to replace only a few components on the page.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 41 guests