To me though, there are issues with it that prevent it from being a totally general purpose tag, and I probably won't remember them all here. Here's one though: <custom:label key="ContactForm.lastName"/> assumes that conventions are being followed and that the form name and field names are part of a key in the message resources.

I'd be glad to see it in a contrib area, but I'm not sure that its general purpose enough for all the wacky Struts coders out there that don't follow such sensical conventions! :))

Thoughts?


On Wednesday, January 8, 2003, at 11:33 PM, Matt Raible wrote:
Here's a working version - now if we can only get the committers to add
it ;) nudge, nudge

Matt

-----Original Message-----
From: Erik Hatcher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 7:52 AM
To: Struts Developers List
Subject: Re: How do I get a form's name within <html:form>?


Ok, I understand now... yes, thats a flaw in my LabelTag of
course and
it should take into account the form bean on the page, not the action
mapping.

Let me know if you beat me to a fix.  I don't have situations where
this has caused an NPE for me (yet), but would like to make sure its
robust enough for others to use.

	Erik


On Wednesday, January 8, 2003, at 09:41  AM, Matt Raible wrote:
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?
My ActionForward is thus:

    <action
        path="/userProfile"
        type="org.apache.struts.actions.ForwardAction"
        parameter="userProfile"/>

So there is not formBean on it - I suppose I could add one - but the
form
where I'm getting the NPE *does* have a mapping with a formBean.
Here's my form:

<html:form action="editUser" focus="firstName"
    styleId="userForm" onsubmit="return validateUserForm(this)">

And the action-mapping for it:

    <action
      path="/editUser"
      type="org.appfuse.webapp.action.UserAction"
      name="userForm"
      scope="session"
      input="mainMenu"
      parameter="action"
      unknown="false"
      validate="false"

I realize - what the heck are you using session scope for?? - but I
think
people might use this in the real-world, and it'd be cool if the
LabelTag
allowed for it.

Hope this helps to explain my problem better.

Matt



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



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

<LabelTag.java>--
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