0

I am migrating some old JSP files to Facelets in an old web application where I also migrated from MyFaces 1.1 to MyFaces 2.2.12 beforehand. The JSPs use the a4j tag library which - if I understood correctly - isn't needed anymore in JSF 2 and Facelets, thanks to the native f:ajax tag.

I read Migrating JSF 1.1 with Ajax4jsf 1.x to JSF 2, but being the JSF beginner I am, had problems with some of the advices in BalusC's response and need more specific instructions. Specifically, what do I have to do to port some JSP code like this

<a4j:commandLink reRender="myPanel,myself" id="myself">
    <t:updateActionListener value="#{someExpression}" property="#{someExpression}"/>
    <h:outputText value="Test"/>
    <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender"/>
</a4j:commandLink>

<h:panelGroup id="myPanel">
    ...
</h:panelGroup>

to Facelets? From the answer in the question linked above, I tried

<h:commandLink id="myself">
    <t:updateActionListener value="#{someExpression}" property="#{someExpression}"/>
    <h:outputText value="Test"/>
    <f:ajax render="myPanel,myself" />
</h:commandLink>

<h:panelGroup id="myPanel">
    ...
</h:panelGroup>

but I have no idea of how to translate the reRender attribute of the a4j:commandLink or the type="org.ajax4jsf.ajax.ForceRender" of the a4j:ajaxListener element. I also don't know what value the listener attribute of the f:ajax tag should have. It can't be org.ajax4jsf.ajax.ForceRender since ajax4jsf is not supported in Facelets, right?

When trying to run the code above, I get the error message

Component with id:myPanel,myself not found

even though I have components with those ids in my Facelet.

Sorry for being a little ignorant here, and thanks in advance for any help or answers!

Community
  • 1
  • 1
scholt
  • 180
  • 4
  • 19
  • a4j still can be used for JSF 2. Your statement "since ajax4jsf is not supported in Facelets" is not correct. Plain JSF not covered all cases where AJAX from a4j was used. For that purpose there are frameworks like PrimeFaces, RichFaces, .. – Vasil Lukach May 11 '17 at 01:02
  • @VasilLukach thanks a lot for the clarification. I wasn't aware of that. – scholt May 11 '17 at 07:18

0 Answers0