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

    JSF commandButton not rendering whole page

    Alexandru Enache Newbie

      Hi!

      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

      Regards,
      Alex Enache

        • 2. Re: JSF commandButton not rendering whole page
          Alexandru Enache Newbie

           

          <?xml version="1.0"?>
          <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:f="http://java.sun.com/jsf/core"
           xmlns:s="http://jboss.com/products/seam/taglib"
           xmlns="http://www.w3.org/1999/xhtml"
           xmlns:pm="http://PMComponents.com"
           version="2.0">
          
          <jsp:output doctype-root-element="html"
           doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
           doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
          <jsp:directive.page contentType="text/html"/>
          
          <html>
          <head>
          <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>
          </head>
          <body>
           <f:view>
           <h:form id="createUser">
           <h:panelGrid columns="3" styleClass="formText">
           <h:outputLabel for="name">
           <h:outputText value="Name:"/>
           </h:outputLabel>
           <h:inputText id="name" value="#{person.name}" required="true"/>
           <h:message for="name"/>
           <h:outputLabel for="age">
           <h:outputText value="Age:"/>
           </h:outputLabel>
           <h:inputText id="age" value="#{person.age}" required="true"/>
           <h:message for="age"/>
           <h:outputLabel for="email">
           <h:outputText value="Email:"/>
           </h:outputLabel>
           <h:inputText id="email" value="#{person.email}" required="true"/>
           <h:message for="email"/>
           <h:outputLabel for="comment">
           <h:outputText value="Comment:"/>
           </h:outputLabel>
           <h:inputText id="comment" value="#{person.comment}" required="true"/>
           <h:message for="comment"/>
           </h:panelGrid>
           <br/>
           <h:commandButton value="Submit Data" action="#{manager.sayHello }"/>
           </h:form>
           </f:view>
          </body>
          </html>
          </jsp:root>


          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
            Alexandru Enache Newbie

            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.
            Alex