The Java Struts2 in a creep's eye

Source: Internet
Author: User

Old Wei finally can return to the garden, but this time to come back slowly, can not come back, this period of time in addition to take care of the newborn little daughter, but also to do the project. Said the real old Wei time is really limited, can not take care of the garden article, so only slowly back to write the article. I'm sorry!

To write a piece of talk today, about what? About the Java Struts2 article, although the old Wei is not write Java origin, but after all, sometimes the enemy can learn something better! Here, first of all, this article is not to belittle Struts2, but to talk about the old Wei's Struts2 and the idea of ASP.

In the Struts2, although is based on the MVC pattern, but also obtains everybody to approve, may old Wei after all is. Net-born, so it's always a. NET idea to write Java. So maybe the understanding of Struts2 some wrong, please correct me.

We know that when you need to write action in Struts2, the action method needs to return a string, or void. When a string is returned, it is necessary to declare the JSP of the view that the action requires by means of annotations or XML. This point is not very convenient for old Wei, without the convenience of ASP. NET MVC, can be automatically associated with the ASPX file by Aciton name in ASP. NET MVC, or you can specify which ASPX by specifying the view. In fact, this is more convenient. Hopefully you can change this in struts.

Secondly, in the jump aspect, Struts2 is divided into chain,redirectaction and so on. Said the real point is too fine, sometimes old Weidu dizzy, who let Old Wei is a soldier! Alas, if it were the masters, there would be no such problems. The jump in ASP. NET is relatively simple and not so complex.

To talk about the application aspect, Old Wei found in Struts2 some things I feel is still relatively good, especially in the page aspect, sometimes we just need to provide a page, this page does not need to pass controller, just to display the form and so on. So you can access the JSP directly. But in ASP. NET MVC, each view has to go through a controller, so in this respect, Old Wei hopes that ASP can learn.

Look at the configuration of the Manage action in struts, In the struts2.xml need to manage the action, then he is managed through the package, in the package if you want to jump between the action, then you have to consider the problem of the path, perhaps this is the stage for each creep to go through, the path location is not good to find actio N or JSP, especially after the dynamic method call in configuration Struts2, if you want to jump to the other action in this class, you can do it in 2. Finally old Wei can't stand the configuration file, only write a jump method through.

Write here, Old Wei think that the beginning of the Java EE time is put on the configuration file, and old Wei engaged for a lifetime. NET, write the configuration file can be counted, perhaps this is a difference between Java and. NET, Java configuration file a lot of, led to learning when the dizzy, not very acceptable ah, but after all, Java in the big project when the configuration file is necessary Ah! To look at. NET, come up with code, almost no deal with the configuration file, but as the project needs, the configuration of more and more things, VS provides the Config file is very intelligent, can help us write configuration.

Said here, Old Wei's summary is to learn Java need to stabilize the hand, learning. NET needs a strong brain capacity to accept new knowledge, and constantly improve themselves! As a Java creep, this is my confession. Oh.

The Java Struts2 in a creep's eye

Related Article

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.