Yesterday I asked a question about the need to double-click a button to make it work. I got good help, which is the hallmark of stackoverflow, but the problem still exists. I cut my code to a minimum and the problem still exists. I carefully read the BalusC proposal, hoping that I would find the form inside the form. Of course, I donโt see anything, so I will send my code in the hope that additional pairs of eyes will see something.
I have a template that I call from the greeting (part of the input). This applies to userInfo, which has a command button. This is the button that I mysteriously must click twice. When I press the second button, the command button will lead me to userPhoto. Everything is cut to a minimum so that I can publish it.
master.xthml:
<?xml version="1.0" encoding="UTF-8"?> <!-- To change this template, choose Tools | Templates and open the template in the editor. --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <h:head> <title>Master template</title> </h:head> <h:body> <p:layout fullPage="true" > <p:layoutUnit position="north" size="254"> Top </p:layoutUnit> <p:layoutUnit position="east" size="50" resizable="true"> Hello </p:layoutUnit> <p:layoutUnit position="south" size="30"> south </p:layoutUnit> <p:layoutUnit position="center"> <ui:insert name="AreaOne">Default text</ui:insert> </p:layoutUnit> </p:layout> </h:body> </html>
welcome1.xhtml:
<?xml version="1.0" encoding="UTF-8"?> <!-- To change this template, choose Tools | Templates and open the template in the editor. --> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <ui:composition template="master.xhtml"> <ui:define name="AreaOne"> <h:form id="form1"> <p:commandButton type="submit" value="Login" action="userInfo" /> </h:form> <p:messages /> </ui:define> </ui:composition> </html>
And last but not least, userInfo.xhtml with a button that you need to double-click:
<?xml version="1.0" encoding="UTF-8"?> <!-- To change this template, choose Tools | Templates and open the template in the editor. --> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <ui:composition template="master.xhtml"> <ui:define name="AreaOne"> <h:form id="formP"> <p:commandButton type="submit" value="photos" action="userPhoto" /> </h:form> <p:messages /> </ui:define> </ui:composition> </html>
I donโt see any form embedded in any other form, but SOMETHING is wrong, and I canโt understand that. Perhaps BalusC is correct that it has something to do with ajax, but I don't see that either.
Thanks for the help. Ilan
I added a button on the userPhoto page, which returns to the user information page. The "Login" button is the only one that works the first time it is clicked. When I use the command buttons to switch between userInfo and userPhoto, it always takes 2 clicks. I will show the center userPhoto
<ui:composition template="master.xhtml"> <ui:define name="AreaOne"> <h:form id="form3"> <p:commandButton type="submit" value="home page" action="userInfo" /> </h:form> <p:messages /> </ui:define> </ui:composition>