Struts2 's STRUTS2 source analysis

Source: Internet
Author: User

First, study case:struts2 said this can basically end. I do not know how people feel, anyway, I have forgotten, you do. Don't say you remember it all. If you really remember, well, please leave a name and photo below this article, I will stick to the bed, worship every day. Oh. To get backto the point,struts2 Some basic things that were basically explained in the previous article, and with the project demo. Not to say,struts2 's blog is over, your study is over, I also said, I have forgotten, if you do not forget, but really is not the average person. Like the Zhang Sanfeng of Taiji and Zhang Mowgli, normal people learn things like this. Forget about the review. OK, then there is a chapter is about struts2 source Analysis, interested friends can get started under the operation. Of course , it is time to learn hibernate , this is my previous study of the framework of the route, I feel there are some benefits, so the next goal is hibernate.

Second, case analysis: About struts2 Source Analysis, I take it for granted from the Interceptor, in the Web. XML We configure the interceptor, still have the impression, before, I also said, Struts2 has a lot of things that are dependent on interceptors. So we start with Strutsprepareandexecutefilter.

A) First, we open the document to see an interface,actionproxy,Action agent, about the agent mode of things, we can self-Baidu understand. We can see that it has the execute() method, the same form as action, the role of everyone with the help of the way to see it, my level four has not yet, dare not to translate, hehe. The general idea is that execute () in action is the one that controls it.

b) There is also a getmethod (), which presumably means to get the method that we configured on the action in Struts.xml, if it is not NULL, then execute, or NULL to execute the default execute ().

c) Of course he is just an interface, and the framework actually uses its implementation class Strutsactionproxy. It provides only two methods:execute(),prepare(); You can understand it, don't do too much explaining.

d) Well, next we look at Strutsprepareandexecutefilter, learning this class, we're going to use debug to see. Still do not know what debug is to do, hurry to ask degrees Niang.

e) It is under Org.apache.struts2.dispatcher.ng.filter, we open it under MyEclipse.

f) We find the init () method and add a breakpoint to the first statement below the try. Then start Tomcat, where startup is started with debug, the normal start of no way to debug.

g) Let's clear the contents of the console output and press F6 until the console has the content output, then stop to view the output log.

h) When executed to dispatcher = init.initdispatcher (config); When this statement is made, three configuration files are loaded. So we add a breakpoint in front of the statement, Restart press F5 to enter the view.

i) we find dispatcher.init () before return; such a word, so we proceeded to press F5 go in and see.

j)I can view them in a click,Init_traditionalxmlconfigurations ();when we can seeconfigpaths =default_configuration_paths;, we press CTRL and click Go to see Private Static FinalStringdefault_configuration_paths = "Struts-default.xml,struts-plugin.xml,struts.xml";now know whythe order in which the configuration files were loaded at Tomcat startup. Of course, the next step is to parse the configuration file.

Third, Experience:

A) learning knowledge do not be afraid to forget, normal people will forget, forget to review just. You'll be a Daniel when you review it 35 times. Oh, a joke.

b) learning languages, in particular, requires patience and carefulness. Beginners are prone to make mistakes, and sometimes a problem is common throughout three or four hours, so be patient and careful enough to reduce unnecessary hassles. The purpose of my blog is to share with you my learning experience, but also to avoid some unnecessary trouble and to take a few detours. Don't say brother Tall on Oh, brother just for the computer industry to contribute their own strength. Hey. That's a little tall. Well, today is these, tomorrow there is a chapter about struts2 , will be released in time.

Iv. Reference items: None.

Five, a day of joy:

My husband wrote to me in the first letter, said:" every time you see me is like a rabbit in my heart everywhere hit." "

Now we have been married for 5 years, whim and this fellow spoiled:" hubby, your heart of the rabbit?" "

Husband:" hit the dead early. "

The final interpretation of the right to find partners (www.23hhr.com) All, reproduced please indicate the source.

Struts2 's STRUTS2 source analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.