Matt - that seems like a reasonable change to me, although maybe its even more robust to find the parent form tag and call the getBeanName() method there?

I haven't had a chance to try the change to see how it affects my project yet though.

I'm confused on why your ActionForward action doesn't have a form bean associated with it though. How does the <html:form> tag know what form to use then?

Erik

On Tuesday, January 7, 2003, at 11:44 AM, Raible, Matt wrote:
I'm looking to do some enhacements to Erik Hatcher's LabelTag. Currently,
it gets a form's name with the following code:

ActionMapping mapping =
(ActionMapping) pageContext.getAttribute(
Globals.MAPPING_KEY,
PageContext.REQUEST_SCOPE);
String formName = mapping.getAttribute();

However, this only works if there is a mapping the request scope. I've run
into a couple NPE on pages that are forwarded to using an ActionForward -
and the form still renders (without the LabelTag). So I'm wondering how I
can get the form's name if I'm within an <html:form>?

After looking at FormTag.java, is this the best way?

String formName = (String) pageContext.getAttribute(Constants.BEAN_KEY,
PageContext.REQUEST_SCOPE);

Feel free to send me a link to CVS to view the source for a class there.

Thanks,

Matt


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



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

Reply via email to