Good day. Faced the following problem. For some reason, the button in the application does not work. I ask you to explain what could be the "stunts"

Form fragment (Preceded by <_h: form>)

<p:panel> <p:commandButton value="Проверить" actionListener="#{newObject.updatePreview()}" update="screenshotCamera" type="button"/> <br/> <p:graphicImage id="screenshotCamera" cache="false" url="#{newObject.JPGLink}" width="120px" height="120px" alt="Не удается подключиться к камере. Проверьте настройки" /> <br/> <h:outputText value="Если изображения нет, то что-то не так в настройках. Перепроверьте, или обратитесь в службу поддержки." /> <h:panelGrid columns="1"> <h:panelGrid columns="2"> <h:outputText value="Отображать на карте?"/> <p:inputSwitch value="#{newObject.createdCamera.showInTheMap}" onLabel="Да" offLabel="Нет" /> <h:outputText value="Выберете объект :" /> <p:selectOneMenu value="#{newObject.selectedFacility}" effect="fold" > <c:forEach var="facility" items="#{newObject.facilitysForSelect}" > <f:selectItem itemLabel="#{facility.title}" itemValue="#{facility}" /> </c:forEach> </p:selectOneMenu> </h:panelGrid> <p:commandButton value="Все верно!" action="#{newObject.createCamera}" actionListener="#{viewController.setCurrentContent('cameras')}" /> </h:panelGrid> 

Bean Fragment:

 public void updatePreview(){ createdCamera.setJPGLink("http://"+cameraLogin+":"+cameraPassword+"@"+cameraWanIP+":"+cameraPort+"/Streaming/channels/1/picture?snapShotImageType=JPEG"); System.out.println("Link updated"); } 

So the console is silent. No errors, no messages. Both in the console and in

  p:messages autoupdate="true" 
How or what to debug?

  • Information is not enough to give an unequivocal answer, because The incomplete JSF page and incomplete Java bean class are shown. The sources of the problem may be different, and without having more complete information, you can only make assumptions, and not give specific answers. If the JSF page is too large, make a copy of it that does not contain unnecessary information, while allowing you to reproduce the error. - bobzer

1 answer 1

 <p:commandButton type="button"/> 

PrimeFaces 5.2 user guide, p 112

Push buttons are used to execute custom javascript without causing an ajax / non-ajax request. To create a push button set type as "button".

Actually type="button" serves to prevent sending a request to the server when pressed.