Ajax not working in JSF 2 application

I get errors when trying to update a form using <f:ajax render="@form" listener="#{myBean.onSelectItemChange}" />

A message in the popup window "emptyResponse: an empty server was received from the server. Check the server error logs."

In the Firefox console, the error "XML Parsing Error: XML or text ad is not at the beginning of the object location"

The same code works well in my local environment. I use Tomcat 9 in both local and production environments. I get errors only in production.

The xhtml page starts with

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

When rendering, the top of the page is automatically added <!DOCTYPE html>.

I also tried adding <?xml version="1.0" encoding="UTF-8"?>to the top of the page.

Edit: : XML: XML . : http://serverIP:8080/app/myPage 2, 1:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>

: XHR :

<?xml version='1.0' encoding='UTF-8'?>
<?xml version='1.0' encoding='UTF-8'?>
<partial-response>
...
</partial-response>

, . Tomcat9 (Windows) (Ubuntu).

+4
2

, XHTML . browswer .

, , , "duplicate". ( google), , Q/A in Stackoverflow Q/A : Ajax , Firefox: XML

:

  • " "
  • -
+3

, "Inspect elements", id
- :

<f:ajax render="element:element1" listener="#{myBean.onSelectItemChange}"></f:ajax>
-2

Source: https://habr.com/ru/post/1686613/


All Articles