Matt: This is the code I use in my tags to walk the tag stack. If I remember correctly, Aaron (the nested tags guy), had a problem with walking the tag stack and had a different solution. You can find that in the nested tag library.
The default message file has a handle in the request / session using the o.a.s.Globals.MESSAGES_KEY. Edgar public static ActionForm findActionForm(PageContext context, Tag tag) { String bean = findBeanName(tag); if (bean == null) { log.warn("findActionForm: could not find the bean"); return null; } return (ActionForm) context.findAttribute(bean); } public static String findBeanName(Tag tag) { FormTag ft = findFormParent(tag); if (ft == null) { log.warn("findBeanName: couldn't find HTML:FORM tag"); return null; } return ft.getBeanName(); } public static FormTag findFormParent(Tag tag) { if (tag == null) { log.warn("findFormParent: the supplied tag was null"); return null; } if (tag instanceof FormTag) { return (FormTag) tag; } return findFormParent(tag.getParent()); } -----Original Message----- From: Kruse, Matt [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 12:41 PM To: 'Struts Users Mailing List (E-mail)' Subject: Can an <INPUT> tag know its form name? Also, application resources... In writing a taglib for my calendar popup, I've come across two questions: 1) I need to write javascript which references the generated <input> tag. To do this, I need to know the name of the form that it is contained in to get a javascript reference to it. If no form name is found, I'll default to form [0]. This isn't working: protected String getFormName() { // Acquire the form tag we are associated with FormTag formTag = (FormTag)pageContext.getAttribute(Constants.FORM_KEY); if (formTag==null) { return "0"; } else { return "'"+formTag.getName()+"'"; } } I took this from the <html:option> tag as an example. Is this not possible for the form tag? 2) I have a .properties file for my taglib which defines standard text and default options. It would be great if a user could over-ride those settings with messages in their own application-specific MessageResources. Is there a generalized way, in my taglib code, to get a reference to the application's message resources so I can search for keys that over-ride my defaults? The other option I thought of is that the developer can extend my taglib with their own and point to their own MessageResources file, but this isn't as slick. Any other options? PS: Just have to clear up these two things and write more examples and it'll be ready for testing... Thanks! Matt Kruse --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]