On 11/17/05, David Whipple <[EMAIL PROTECTED]> wrote: > > > I would like to be able to create a custom tag which is able to use the > struts <html:text>, <html:dropdown> or <html:hidden> fields. I am not able > to find a way to create a tag library that can produce/call/reference > other > tags.
You didn't miss anything ... that strategy is not technically feasible. There is only one pass through the compile stage that converts a JSP page into Java code ... even if you wrote a custom tag that output "<html:text ...>" that text would just be literally written to the output stream. I am interested in making a custom tag for our application which will > either show a text entry field, a dropdown or a static text entry based on > the choices available to a particular user. The choices will probably be > passed in as a collection in the request, where a single value results in > a > hidden field (no choice for the user), a set of values results in a > dropdown, and a special case of a single value zero, which means the user > can enter anything they like through a text entry field. You'd need to write a new custom tag that copies the rendering logic of the tags you are choosing between, suitably conditioned with an if statement that checks the condition. I have searched everything I can think of and can't seem to find anything > that can allow this. > > Does anyone know a way to approach this? > > Thanks, > Dave Craig PS: This kind of need is an area where component architectures like JavaServer Faces can be handy ... it's much easier in that world to create a component that conditionally creates a child component of the correct type, and then renders it, without having to duplicate all the rendering logic. --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >