The FORMBEAN in Struts is mainly used to encapsulate (by reflecting) browser or formal data submitted by clients using the HTTP protocol. I think everyone has reached a consensus, there is nothing to say, in this level, The form struts tag seems to have no use of Wu Zhi, in fact, this is actually the same, using ordinary HTML TAG can achieve the same effect. But a little important is that struts tag can automatically obtain data from the background to fill page.
Let's take an example to explore this mechanism:
Existing two Action class, AAction, BACTION
Two FORM class, AFORM, BFORM
A page: a.jsp
These five elements are as follows:
AACTION uses AFORM, BAction Use bform, AADION Corresponde A.jsp, AFORM, and BFORM all contain x and y properties, some of the key code of A.JSP is as follows:
html: form>
When clicked with AAction (assuming), AFORM.X = 10, and AFORM.X = 10, AFORM.Y = 20, A.jsp, but input box x, and y blanks, but if AFORM is BForm, two input boxes will appear 10 and 20, in fact, there is no need to write Request.SetaTRibute ("Vo", AFORM), and Struts has a very important feature: when starting an action, Struts instance Corresponding FORM (if any), when FORWARD, automatically write request.setttrbute (formname, form), formname, you are defined in the configuration file, click AAction in this example, When Action Forward, Request ("AFORM", AFORM) is automatically written, so when you want to lazy directly to fill the data on the page, you don't need to write this.
Of course, if AFORM is not BFORM, you can also write this effect like this.
It can be inferred by the above:
html: form>
Actually
html: form>
It is worth noting that BFORM can be empty, if you change Name = "bform" to Name = "vo" is of course another name, Vo can't be empty
From this time when AFORM is not BFORM, we have a simpler solution that writes Request.SetAttribute ("BFORM", AFORM).
This will not change the page, but you must pay attention to AFORM must have the corresponding properties.
postscript: