2 Replies Latest reply on Jul 18, 2008 11:49 AM by Marco Brandizi

    Automatic generation of editing form

    Marco Brandizi Newbie
      Hi all,

      I am very new to Seam and I wonder if there is any automatism for dynamic building of entity editing and alike.

      I know seam-gen is able to spawn scaffolding, however this is not what I have in mind. For instance, for what concerns the edit form for a single entity, I'd like to write in PersonEdit.xhtml something like:

      <h:form>
        <mys:edit-fields entity = "person" />
        <mys:edit-buttons entity = "person" />
      </h:form>

      and the fields are automatically rendered from Entity annotations (Hibernate annotations about field size and alike, + additional annotations for defining rendering properties). The editing form would be built automatically at run time, without the need to create it, manually or via seam-gen.

      This is more powerful than scaffolding. For instance, one could define a customised rendered for a particular field, again by means of annotations or with a syntax like:

      <h:form>
        <mys:edit-fields person = "person">
          <my:renderer field = "comments" class = "eg.MyRenderer" />
        </mys:edit-fields>
        ...
      </h:form>

      More straightforward, I'd like that Xedit.xhtml is needed only in case of customisation, otherwise a standard structure and set of URLs should be available for CRUD.
      A similar approach is followed by Symfony, a PHP framework (http://www.symfony-project.org/book/1_1/14-Generators).

      Thanks in advance for replying.