[jboss-user] [JBoss Seam] - DRY Edit pages

awhitford do-not-reply at jboss.com
Mon Jun 4 23:13:06 EDT 2007


Consider the following seam-gen generated snippet from an Edit.xhtml:

  |                 <h:inputText id="code" 
  |                        disabled="#{countryHome.managed}"
  |                        required="true"
  |                            size="2"
  |                       maxlength="2"
  |                           value="#{countryHome.instance.code}">
  |                     <a:support event="onblur" reRender="codeDecoration"/>
  |                 </h:inputText>
  | 

I like how seam will impose my Entity bean restrictions at the UI level, so that my @NotNull constraint is translated into a required="true", and my @Length(max=2) constraint is translated into a maxlength="2".  But I'm concerned that this is repeating oneself -- especially when a change is made.  If a constraint is changed on the @Entity bean, I need to update the Edit page in addition to the database...  Why can't the Edit page be driven by the meta-data of the Entity bean at run-time?  I would like the framework to interrogate the Entity bean's meta data for required and maxlength if they are not specified.

(If this is a conscious decision based on the poor performance of reflection, then I understand.  Too bad the xhtml couldn't be enriched from meta data at build time.)


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4051155#4051155

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4051155



More information about the jboss-user mailing list