Hanikh, You can instantiate a tag from within a tag. You would need to set the
appropriate tag setters like setParent and setPageContext. It may or may not work depending on how the tag was written. I also don't think it is an ideal way to nesting tags but it does work when the output of one tag changes enclosed tags. David Morris >>> [EMAIL PROTECTED] 11/30/01 10:05AM >>> Oh, well, maybe I wasn't clear in my question. I want <myTagLib:myTag /> to somehow "replace itself" by a set of struts tags. I don't think findAncestor would do it. Am I missing something in your thoughts? Thanks for your answer anyway. -----Original Message----- From: Matt Raible [mailto:[EMAIL PROTECTED]] Sent: Friday, November 30, 2001 12:06 PM To: Struts Users Mailing List Subject: Re: Is there a way to "call" a struts custom tag from your own custom tag? You could probably use findAncestorWithClass(Tag, Class) http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/jsp/tagext/Ta gSupport.html --- Hani Hamandi <[EMAIL PROTECTED]> wrote: > Hi, > > My question is actually simple. > I would like to write my own custom tag that, for example, builds a form > using the struts custom tags. > > For example, I would like to write a tag like this one: > > <myTabLib:mytag /> > > Which, for example, does this: > > <html:form action = "myAction.do"> > <bean:message key = "myLabel" /> > <html:text property = "myField" /> > </html:form> > > > > This is just an example, I am not particularly interested in building a > form. The key question is how to get your container to actually execute > another custom tag from within your doStartTag() method for example. If you > do out.print("<bean:message key = \"myLabel\" />"), of course this will > simply be sent back to the browser as is (text), without any interpretation > on the server side. > > I don't know, maybe this is not doable at all, but thanks in advance for any > suggestions, > Hani. > > P.S: The thing is, if this is not doable, then using struts kinda prevents > you from writing your own custom tags (unless you extend the struts stuff). > I wanted to write my own custom tag which reads some data from the database, > does a couple of things, and builds an <html:select> with the data. But > that's exactly where I got stuck: at the <html:select>! Of course, the > regular <select> would work just fine, but you do want to use the > <html:select> for struts to populate your bean. So I ended up using a <%@ > include>, at least for now. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>