title: How to handle generated at JAVA side JSF Form?
body: <p>I'm generating my JSF Form html element at java (adding inputs, labels, etc) at <code>parseHtml()</code> method. I need to handle it. When I'm putting to every input value #{foo.bean} it shows me this symbols into input. How to do it correctly?</p>
  
  <pre><code>    @ManagedBean(name = "parserBean")
  @RequestScoped
  public class DataFormParserBean {
  
      @ManagedProperty(value = "#{fieldService}")
      private FieldService fieldService;
      @ManagedProperty(value = "#{builderBean}")
      private BuilderManagedBean builderManagedBean;
  
      private List&lt;Field&gt; fieldList;
  
      private List&lt;Object&gt; listWithData;
  
      private Integer index = 0;
  
      @PostConstruct
      public void init() {
  
          fieldList = fieldService.getListOfFields();
          listWithData = new ArrayList&lt;&gt;(fieldList.size());
  
      }
  
      public FieldService getFieldService() {
          return fieldService;
      }
  
      public void setFieldService(FieldService fieldService) {
          this.fieldService = fieldService;
      }
  
      public BuilderManagedBean getBuilderManagedBean() {
          return builderManagedBean;
      }
  
      public void setBuilderManagedBean(BuilderManagedBean builderManagedBean) {
          this.builderManagedBean = builderManagedBean;
      }
  
      /**
       * Method provides parsing String description of fields(from database) to
       * UIComponents and display them on screen
       * 
       * @return HtmlForm object that contains
       */
      public HtmlForm parseToHtml() {
          HtmlForm form = new HtmlForm();
          fieldList.forEach(item -&gt; {
              form.getChildren().add(createLabel(item));
              form.getChildren().add(builderManagedBean.getMapWithBuilder().get(item.getType()).build(item, index));
              index += 1;
          });
          form.getChildren().add(createSubmitButton());
          return form;
      }
  
      private HtmlOutputLabel createLabel(Field field) {
          HtmlOutputLabel label = new HtmlOutputLabel();
          label.setValue(field.getLabel());
          return label;
      }
  
      private HtmlCommandButton createSubmitButton() {
          HtmlCommandButton button = new HtmlCommandButton();
          button.setValue("Add");
          button.setId("addDataButton");
          return button;
      }
  
  }
  </code></pre>
  
  <p>And here I'm invoking this method and it shows me my form. But how I can handle it?</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;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://java.sun.com/jsf/facelets"
      xmlns:b="http://bootsfaces.net/ui"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"&gt;
  &lt;h:head&gt;
      &lt;title&gt;Add data&lt;/title&gt;
      &lt;h:outputScript library="js" name="jquery-3.2.1.min.js" /&gt;
  &lt;/h:head&gt;
  &lt;h:body&gt;
      &lt;h:form&gt;
          &lt;b:commandButton look="link" action="response?faces-redirect=true"
              value="#{responseBean.count}" /&gt;
          &lt;b:commandButton look="link" action="fields?faces-redirect=true"
              value="Fields" /&gt;
      &lt;/h:form&gt;
  
  
      &lt;h:form binding="#{parserBean.parseToHtml()}"&gt;
  
      &lt;/h:form&gt;
      &lt;p:socket onMessage="handleMessage" channel="/counter" /&gt;
      &lt;script type="text/javascript"&gt;
          function handleMessage(data) {
              $('.display').html(data);
          }
      &lt;/script&gt;
  &lt;/h:body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>UPDATE</strong>
  My web.xml file with configs</p>
  
  <pre><code>    &lt;!DOCTYPE web-app PUBLIC
   "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd" &gt;
  
  &lt;web-app&gt;
      &lt;display-name&gt;Archetype Created Web Application&lt;/display-name&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;JSF Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;JSF Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;JSF Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;fields.xhtml&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>