jQuery in Action, 3rd edition
The moose likes JSF and the fly likes How to refresh (rerender) a subview with Dynamic Faces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to refresh (rerender) a subview with Dynamic Faces" Watch "How to refresh (rerender) a subview with Dynamic Faces" New topic

How to refresh (rerender) a subview with Dynamic Faces

Enrique Villamizar
Ranch Hand

Joined: Jul 30, 2005
Posts: 93
Hi everybody:

I keep on learning...my first problem today is that I need to refresh a subview after the user updates data in a form.

The subview id is vistaCliente and inside there is an Ajax Zone <jsfExt:ajaxZone id="autoUpdate"> ... </jsfExt:ajaxZone>

The user fills a form then has to click on a commandLink:

The method processAction render the subview in this way:

The subview "vistaCliente" (is a form too) is created at the sametime with the first form but not showed ( <f:subview id="vistaCliente" rendered="false"> ).

The function of vistaCliente is to show the data if the customer is already registered in the database. If the customer is not in the database, vistaCliente is ready to get the additional data of the new customer for saving in the database.

To make things simpler the vistaCliente has its own back bean ... also because thinking of reusing it in other pages.

The question: what is the way of using Ajax to refresh the subview "vistaCliente" when the customer is in the database from the processAction. Or put it in another way...how to refresh a view from another view? I tried to create an object of the VistaClienteBean from another bean and used the set methods to refresh the data but it doesn´t work... Do I have to use the same back bean?

As usual many thanks for your cooperation.

Enrique Villamizar
Ranch Hand

Joined: Jul 30, 2005
Posts: 93
Another attempt,

In the first back bean: A call to the update() method of the second bean.

The update method of the second bean recieve data and call its own setters to updated the initial information. But it doesn't work.

I understand that if the view and the subview depended on the same back bean this would work.
Am I right?

But I also think that the two back bean communication is possible....yes?

I read but didn't understand in Project Dynamic Faces -- a Variation on Adding Ajax to JavaServer Faces Technology Components :

<jsfExt:ajaxZone id="selectzone"
<h:commandButton id="Selection1" ...
<h:commandButton id="Selection2" ...
<hutputText value= .../>
<h:selectOneMenu .../>

action="#{updateOutput}" ...the updateOutput is a property or a mehtod, is Javascript or Java? where and how I code the updateOutput to refresh the subview?

Please, could anyone give me a hand?
I agree. Here's the link: http://aspose.com/file-tools
subject: How to refresh (rerender) a subview with Dynamic Faces
It's not a secret anymore!