tags:

views:

38

answers:

1

Hi,

I have a JSF application with several major components and a component tree under each.

On a certain event (Value change) I would like to reRender the entire component tree for one of those components.

For example: can I rerender components 1,2 and 3 in one shot here:

<h:panelgroup id="1">
 <h:panelgroup id="2">
  <h:panelgroup id="3">
  <h:panelgroup/>
 <h:panelgroup/>
<h:panelgroup/>

<h:commandButton rerender="1*"> <--- Made up code.

Is that possible?

Another Idea - Can I reRender with wildcards? (I.E - ReRender all components who's ID's begin or contain: "UpdateMe")

Thanks!

+2  A: 

Yes, you can re render whole trees.

You can't use wildcards (afaik), but you can use expressions - for example

reRender="#{yourBean.yourRenderExpression}"

which can return comma-separated list (or a Collection) of elements to reRender.

Generally, you have to pass arguments that follow UIComponent.findComponent(..) algorithm.

Note that <h:commandButton> doesn't have a rerender attribute. It's either <a4j:commandLink and reRender (capitalized), or you should use <f:ajax> from jsf 2.

Bozho