9 Replies Latest reply on Jul 10, 2006 12:27 AM by Gavin King

    Does anyone know of an automatic Seam-JSF form generator?

    Daniel Hinojosa Master

      I was already starting one, but I don't want to start something that someone else already has....if you know of one let me know. If not, I'd be happy to contribute what I have and start it.

        • 1. Re: Does anyone know of an automatic Seam-JSF form generator
          Max Rydahl Andersen Master

          What do you mean by "automatic Seam-JSF form generator" ?

          Something like...given this entitybean; create this jsf-form ?

          Then, no we don't have anything available now, but it is something we would love to have as part of the seam support in hibernate tools.

          Let me know what you want to do.

          • 2. Re: Does anyone know of an automatic Seam-JSF form generator
            Jason Long Master

            How about tweaked out with facelets custom tags.

            Date field calendar components.

            Buiilt in message display next to the field.

            Something that can get you started with something decent, but still highly customizeable before and after generation.

            • 3. Re: Does anyone know of an automatic Seam-JSF form generator
              Max Rydahl Andersen Master

              as long as the generated code is clean and doesn't depend on too weird custom stuff then, sure.

              Just contribute some custom templates to tools.hibernate.org on our JIRA and i'll look at it.

              • 4. Re: Does anyone know of an automatic Seam-JSF form generator
                Jye Tucker Newbie

                I have been giving this a lot of thought lately.

                Since most of my entities will always display a property in the same way (e.g. date, menu, etc) but on many pages. I was considering using annotations on the property which wire it up to a JSF component, validator, converter, etc.

                Then you could use a taglib to render a specific property based on whether you are doing input or output.

                So <z:input property="#{entity.prop}/> may render an inputText but <z:output property="#{entity.prop}/> may be an outputText.

                Then I guess you could also have a taglib to iterate over all properties on the entity and render the whole form.

                Simple things like inputText fields would be very easy but I haven't got my head around more advanced things yet - like how to wire up a menu with predefined select items to set a property.

                My thinking is that this could be used to speed up UI development in most cases, or you could still drop back to hand-coding the JSF/facelets if you need something more advanced.

                I'd be more than happy to help, or even head up a project to get this happening if there is enough interest.

                • 5. Re: Does anyone know of an automatic Seam-JSF form generator
                  Max Rydahl Andersen Master

                  There is already a project for this and it is the seam app generator in tools.hibernate.org.

                  Check it out and submit improvements too it.

                  Note the current stuff uses the hibernate meta model as a basis of generation. So it work against any Hibernate or EJB3 mapped javabean (which is good imo ;)

                  Your idea seem to be generate it more dynamically is that correct ? My problem with that is that there is no real good way of getting that information portably - but relying heavily on defaults/convention can make it go a long way.

                  but look into tools.hibernate.org and see if you can extend/improve/change the current state of affairs to be JSF forms instead. (currently they are JSP's :(

                  • 6. Re: Does anyone know of an automatic Seam-JSF form generator
                    Jye Tucker Newbie

                    My understanding of the current hibernate application generation tool (I assume that's the one you are talking about) is that the generation happens at build-time, whereas I am talking about runtime generation. But perhaps in future the Seam application generator could generate this code :)

                    I think we could still get the information fairly portably at runtime using EL and the Seam or JSF VariableResolver.

                    As an example, something like this might wire up a property to display a menu with a list of options from a managed bean.

                    @UI(type=UIType.SelectOneMenu, items="#{selectItems.propOptions}")
                    public String getProperty() {}
                    


                    • 7. Re: Does anyone know of an automatic Seam-JSF form generator
                      Thomas Heute Master

                      Mixing UI and dataModel is usually not great.

                      And yes you are talking about the same tool (built by Max).

                      Runtime generation with JSP is pretty messy, i never tried with JSF though...

                      • 8. Re: Does anyone know of an automatic Seam-JSF form generator
                        Jye Tucker Newbie

                        How about I whip up a proof of concept as soon as I can to test the concept and interest. Stay tuned.

                        • 9. Re: Does anyone know of an automatic Seam-JSF form generator
                          Gavin King Master

                           

                          "jtucker" wrote:
                          My understanding of the current hibernate application generation tool (I assume that's the one you are talking about) is that the generation happens at build-time, whereas I am talking about runtime generation. But perhaps in future the Seam application generator could generate this code :)

                          I think we could still get the information fairly portably at runtime using EL and the Seam or JSF VariableResolver.

                          As an example, something like this might wire up a property to display a menu with a list of options from a managed bean.

                          @UI(type=UIType.SelectOneMenu, items="#{selectItems.propOptions}")
                          public String getProperty() {}
                          


                          How I would approach this is to write a JSF control that can iterate over properties of a bean in the same way h:dataTable iterates over elements of a list.