3 Replies Latest reply on Sep 12, 2007 7:16 AM by alex_enache

    JSF commandButton not rendering whole page



      I'm having troubles with the JSF commandButton. When I create an input form, at the end of the form I put a JSF commandButton which should persist my data entered into the form. The problem is that all the controls that are in the form(including the JSF button) are not rendered. And even more, all the controls that are above the form are also not rendered. I've changed the JSF commandButton with the SEAM button and all looks good. It's just that my form is now not submited. I have no idea on this. Please some thoughts, since I cannot continue my project because of this.

      I'm using:
      -JBoss 4.0.5
      -SEAM 1.2.1

      Alex Enache

        • 1. Re: JSF commandButton not rendering whole page

          show some code

          • 2. Re: JSF commandButton not rendering whole page


            <?xml version="1.0"?>
            <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
            <jsp:output doctype-root-element="html"
             doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
            <jsp:directive.page contentType="text/html"/>
            <title>Project Manager - Test2</title>
            <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
            <link rel="stylesheet" type="text/css" href="mootools.css"/>
            <script type="text/javascript" src="mootools.js"></script>
            <script type="text/javascript" src="site.js"></script>
             <h:form id="createUser">
             <h:panelGrid columns="3" styleClass="formText">
             <h:outputLabel for="name">
             <h:outputText value="Name:"/>
             <h:inputText id="name" value="#{person.name}" required="true"/>
             <h:message for="name"/>
             <h:outputLabel for="age">
             <h:outputText value="Age:"/>
             <h:inputText id="age" value="#{person.age}" required="true"/>
             <h:message for="age"/>
             <h:outputLabel for="email">
             <h:outputText value="Email:"/>
             <h:inputText id="email" value="#{person.email}" required="true"/>
             <h:message for="email"/>
             <h:outputLabel for="comment">
             <h:outputText value="Comment:"/>
             <h:inputText id="comment" value="#{person.comment}" required="true"/>
             <h:message for="comment"/>
             <h:commandButton value="Submit Data" action="#{manager.sayHello }"/>

            If I put a SEAM button instead of the JSF commandButton it renders correctly, but it does not do what I want.

            • 3. Re: JSF commandButton not rendering whole page

              Hey Stephen. Thank you very much for asking for the code! After I posted the code, I started thinking that maybe it's not the code of the form that has bugs. So I looked through the rest of the code. And I've done two things:
              1. I've modified the version attribute of the jsp:root tag to 1.2
              2. I've added the tomahawk jar to my server's lib directory and set one context parameter in the web.xml file: org.apache.myfaces.DETECT_JAVASCRIPT to true.

              I'm using Firefox and I looked at the source code that was generated. And I saw that the pieces of code that should be rendered where not highlighted as they should be. This was because they were seen as js code. That is why I added that parameter to the web.xml

              Thanks again Stephen! All looks and works great.