my dog learned polymorphism
The moose likes Struts and the fly likes struts form bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts form bean " Watch "struts form bean " New topic

struts form bean

Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Hi ranchers,

Struts <html:form> tag takes a name and type attribute (form bean name and its complete class name). I want to know what is the significance those two attribute in html:form tag.

Is name and type attribute of <html:form> same as form-bean tag of struts-config.xml. Suppose if I don't specify form-bean tag and just use name and type attribute of html:form for locating form bean class. Will that work?

Thanks in advance


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This has always been a bit confusing.

The name and type are completely unnecessary, because they are already defined for a given action path in the struts-config.xml file. Once you specify the action, Struts can look up the rest. I'm not even sure what happens if you specify a different name or type than what is defined in the config file. Suffice to say that you shouldn't do it.

In the latest version (1.2.9) these attributes are deprecated, and you are no longer able to enter them. For earlier versions, the best practice is not to enter them.

Consultant, Sima Solutions
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Thanks Merrill,

I agree with you. It really create confusion. Now I will try 1.2.9 version.

Thanks once again


I agree. Here's the link:
subject: struts form bean
jQuery in Action, 3rd edition