Vijaykumar Ponnusamy
Vijaykumar Ponnusamy

Reputation: 225

Update one form content from another form in jsf

I need to update one form content from another form in jsf.If i give another form id ,it will show an error like component id not found.

My Coding is

<h:form id="form1" name="form1">
 <h:commandLink value="Tab1" id="Tab1">
  <f:ajax listener="#{managedBean.tabChange}" event="click" render="form2"></f:ajax>
 </h:commandLink></li>
</h:form>
<h:form id="form2" name="form2">
   <h:outputText value="#{managedBean.text}" id="text"/>
</h:form>

in render attribute

@all work for me. but form2/text won't work .

Please Help me.

Thanks in advance.

Upvotes: 2

Views: 11646

Answers (1)

Matt Handy
Matt Handy

Reputation: 30025

Client IDs are relative to their naming container, so JSF looks for a component with the name form2 only inside form1. If you want to escape from this container, you need to prefix your id with a colon.

So the following should work:

<f:ajax listener="#{managedBean.tabChange}" event="click" render=":form2"/>

Upvotes: 10

Related Questions