• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to name html:form tag in sturts

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

before using struts i used to give names for Form tag

like <form name="myform1" action="" method="Post">
controls...
</form>

if a jsp page has more than one form tag ,i can distinguish the control from which form the event is fired..

but in sturts

<html:form name=""> here name refers to formbean

what is the solution to the problem


Thanks
Sreenivas
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts automatically assigns a name to every form created by a <html:form> tag. The name it assigns is the name of the ActionForm bean associated with the action specified by the action attribute. Example:

In the struts-config.xml file:

In the JSP:

When Struts renders the above tag into HTML, it will assign the name "myForm" to the form.
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Merrill

one more doubt,can i have more tahn one <html:form> tag in jsp page,
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can. However, if both forms use the same form bean, they will both have the same name. Therefore, if you want to refer to them in JavaScript, you will have to use something other than the name. You could, for example, refer to them as document.forms[0] and document.forms[1].
[ March 07, 2007: Message edited by: Merrill Higginson ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic