Hi Ted,

Has the <html:control> you mention below been implemented already
or is it in the works at all?

Thanks,
SB

Ted Husted wrote:

> Shishir K. Singh wrote:
>  > Is there a way that I can create a form dynamically based on some XML
>  > configurable file. The configurable file will say  what kind of  input
>  > type it is. Eg "text", "checkbox" etc and accordingly, I  create the
>  > form input types and  then display the fields.
>
> AFAIK, there's no such beast right now, though I keep thinking there
> should be.
>
> Essentially, the idea would be to represent the entire form and all of
> its fields as a JavaBean (or Map of JavaBeans, or Map of Maps), which
> could be instantiated by an XML file. Not unlike the XML form element
> the Validator uses, only more so.
>
> A JSP Tag (or Velocity Tool) could then render the control based on the
> properties of the JavaBean form. So instead of having something like
>
> <html:input property="xyz" ... />
>
> you'd have something like
>
> <html:control property="xyz" ... />
>
> The tag would then lookup the "xyz" property, and then the "controlType"
> property on the xyz JavaBean, and use that value to decide which control
> to render (input, select, ... ).
>
> For extra credit, there could also be tag/tool that could write a
> plain-vanilla version of the entire form as a simple table.
>
> I end up doing this myself eventually, but keep hoping someone will beat
> me to it =:)
>
> -Ted.
>
> --
> Ted Husted,
>    Junit in Action  - <http://www.manning.com/massol/>,
>    Struts in Action - <http://husted.com/struts/book.html>,
>    JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.
>
> Shishir K. Singh wrote:
> > Hello,
> >
> > Is there a way that I can create a form dynamically based on some XML
> > configurable file. The configurable file will say  what kind of  input
> > type it is. Eg "text", "checkbox" etc and accordingly, I  create the
> > form input types and  then display the fields.
> >
> > Eg
> >
> > My JSP looks like this right now (I am using tiles and this is the
> > content section )
> >
> > ------------------------------------------------------------------------
> > ------------
> > <%@ taglib uri="/core"          prefix="c" %>
> > <%@ taglib uri="/struts-tiles"  prefix="tiles" %>
> > <%@ taglib uri="/struts-html"   prefix="html" %>
> >
> > <br><br>
> >
> > <html:form action="/createContentAction">
> >       <table width="60%" border="0.5">
> >               <c:forEach var="lines" items="${contentForm.map.lines}"
> >
> >                       <tr>
> >                               <td><c:out
> > value="${lines.attributeName}"/> </td>
> >                               <td><html:text  indexed="true"
> > name="lines" property="attributeValue"/></td>
> >                       </tr>
> >               </c:forEach>
> >                       <tr>
> >                               <td><html:submit/></td>
> >                       </tr>
> >       </table>
> > </html:form>
> >     <tr>
> >         <td><html:submit/></td>
> >     </tr>
> > </table>
> > </html:form>
> >
> > ------------------------------------------------------------------------
> > ----------------------------
> > Basically my intent is to load  some predefined attributes (by parsing
> > an XML file) and creating the
> > Form on the fly using indexed DynaActionForm (contentForm) . I have been
> > able to get the fields up in the form, but only
> > as text input fields as I am using <html:text tags. However, my input
> > type can be check boxes, or select type and
> > I would like that to be configurable instead of hard coding in the JSP.
> > Is this doable ??
> >
> > Any hints/tips would be appreciated.
> >
> > TIA
> > Shishir
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
NOTICE: If received in error, please destroy and notify sender.  Sender does
not waive confidentiality or privilege, and use is prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to