Whoops - that last one I sent still had a S.o.p - and my * and : where messed up. See attached.
If folks would simply use your strutsgen tool to generate their JSPs and .properties files, it'd be a non-issue right? ;) Now I just need something that will allow me to do this: <c:forEach var="field" items="${form.fields}"> <tr> <td> <h:label key="${field.name}"/> </td> <td> <h:text property="${field.name}"/> </td> </tr> </c:forEach> This'd be a great way to produce a form with all the form's attributes. The bad part - you'd lose control of order of fields, and field size/etc. Maybe a form-config.xml that has somehow determines order of appearance and size. It'd be cool to extend the forms in validation.xml and use that to specify this stuff. Probably a lot of work for something that may never be used though. Matt > -----Original Message----- > From: Erik Hatcher [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 08, 2003 9:43 PM > To: Struts Developers List > Subject: Re: How do I get a form's name within <html:form>? > > > 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:struts-dev-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> >
LabelTag.java
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>