Something like this might work: <bean:define id="actionMappingForThisScreen" name="org.apache.struts.action.mapping.instance" type="org.apache.struts.action.ActionMapping"/> <bean:define id="formName" name="actionMappingForThisScreen" property="name" type="java.lang.String" /> <bean:define id="formBean" name="<%= formName %>" type="org.apache.struts.action.ActionForm"/>
I haven't tested it, but i *think* it'll work since the i *think* the current action mapping is stored in the request under the key "org.apache.struts.action.mapping.instance". The above code should help you get the form bean's name and a reference to the bean itself. chris > -----Original Message----- > From: Davide Bruzzone [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 20, 2002 9:02 AM > To: 'Struts Users Mailing List' > Subject: RE: Getting the current page's form name from within a JSP > page? > > > If I have to do something like this: > > <bean:struts id="form" formBean="MyForm"/> > > I don't really get anything more than if I did this (in my > JavaScript code): > > document.forms("MyForm").submit(); > > i.e. I still have to hard-code the name of the form. This is > what I'm trying > to avoid. > > Thanks for the response though... > > Cheers... > > Dave > > PS In this case, only one form is associated with the page. > > -----Original Message----- > From: Gemes Tibor [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 20, 2002 12:55 AM > To: Struts Users Mailing List > Subject: Re: Getting the current page's form name from within a JSP > page? > > > 2002. szeptember 19. 22:17 dátummal Davide Bruzzone ezt írtad: > > Greetings all (again)... > > > > I was just wondering if there's a way to get the name of > the form that's > > associated with the current view/JSP from within the JSP > (i.e. How would I > > go about getting to the ActionMapping object using Struts > tags so that I > > could get at the name attribute, and could write the value of the > attribute > > to the resulting HTML). > > > > Thanks in advance... > > What if you have one page on which there are 2 forms? Anyway > you can grab > the > reference to the struts-config objects via bean:struts. > > Hth > > Tib > > -- > 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]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>