I have read a lot of information books, I have mentioned the life cycle of Actionform. For example, it is described in "Programming Jakarta Struts": "Please contact it by the controller.
Ask "->" Create or recirculate Actionform "->" call reset () "->" correctly save an actionform "->" Verify ActionForm "->" Verify Actionform ". If
Verification does not return to the input, otherwise call an Execute () method.
Let's take a look at some of the code of the processProcessor () process () method. After some basic processes (such as local, role, etc.), will call ProcessActionform
Method, this method returns an ActionForm. The request parameters are then passed to this ActionForm with the ProcessPopulate method, and then verify it. // Process any ActionForm bean related to this request ActionForm form = processActionForm (request, response, mapping); processPopulate (request, response, form, mapping); (! ProcessValidate (request, response, form, mapping)) if {return; } The processActionform () method calls the requestutils.createActionform () this static method to create an actionform, and protect the created ActionForm
There is a suitable scope for the next use. Requestutils.createActionform () method is not one up to create an actionform, but first check the Actionform if ("Request" .Equals ())) {Instance = (ActionForm) in the appropriate scope. request.getAttribute (attribute);} else {session = request.getSession (); instance = (ActionForm) session.getAttribute (attribute);} if not found, only to find the name attribute in accordance struts-config.xml ActionMapping ( Actionform logical name), find Actionform according to the logical name
Class name, then use similar class.forname ("Actionform's Full Class Name). NewInstance () to dynamically create instances of this ActionForm class. Of course, it still
Consider the situation of DynaActionform, but the principle is the same. This seems that the life cycle of Actionform is not complicated, and there is no need to "explore". In the work, it is not so simple that the actual situation is not so simple.
Due to work needs, we have to do a common action, which can handle a lot of ActionForm. This is a bit interesting, others are doing an actionform being used in several anctions, but we are just the opposite. So I replace the default and rewrite its processactionform () method with custom RequestProcessor. When processing a JSP page,
When I found an actionform, I didn't call my processActionform () method at all. I thought I thought it was Struts-config.xml file was not configured, and P in the parent class
There is a breakpoint in the call () () (the caller of the Processctionform method), and the result is not stopped. I didn't find a problem for a long time, even an actionServlet's init ()
There is no stop in the break point. But Requestutil.createActionForm () is still called. I have not requested an action (xxx.do), but how can I create an actionfor?
m? And the processProcess's process () method is not called. This is quite strange. Is it struts out of Bug, or is JBuilder out of Bug? Later, check it carefully and found that the Struts custom label is "culprit". What exactly happened? It turns out that I use the "html: form action =" xxxx.do "> of the JSP, which creates an actionform. The specific process is: org.apache.struts.taglib.html.FormTag's dostartTag () method calls this.lookup () method to get the actionMApping in
In order to this Action associated with information. After returning the dostarttag () method, it will call RequestUtils.createa in the next this.initformbean () method.
Curation form () method creates or reclaims an actionform. At this time, we know why there will be a problem. But I don't think I don't understand why
Does the properties in
Can't be reused, think about: requesting this JSP is a complete request, and then request xxx.do is another different request, of course, can not be used again. In other words, this ActionForm except
There is no other role in printing the protroperty in the label in
Sign