SSH Framework Learning Summary

Source: Internet
Author: User
Keywords Nbsp; ssh can study summary
Tags class development framework learning learning summary name public public class

SSH Framework Learning Summary

Final copyright: JDram314 such as reprint please post the source!

The SSH framework could have been studied as early as last year, but has been to the teacher to make his research part, so has been dragged until recently was finished. By now have a short summary, convenient to review later.
I. Struts
Before we learn the SSH framework, we typically use Jsp+java bean+servlet development, which is the MVC architecture. Struts actually replaces the servlet, and we know that the servlet does control page jumps in general development and calls the system's business logic layer. Now think about what struts does the same thing? But it can improve the development speed. When we developed the servlet, we were creating a servlet that actually inherited the HttpServlet class. And now the action in struts also integrates a Actionsupport class. As you can see, struts is basically the same as a servlet, but it's also different. Here are the differences:
First from the receive parameter, struts avoids our repeated call to Request.getparameter ("PName"), and struts can seem to be in four ways
1. Use of Modeldriven
When you create the action, you find that the action implements the Modeldriven interface, calls the interface's Getmodel () method, and takes the associated object.
The corresponding submission method can be used with get and post, such as: Testaction? Name=admin
View plain public class Testaction extends baseaction implements modeldriven<resbananrc>{private static final long   Serialversionuid = -7463970150000893325l;   Private RESBANANRC RESBANANRC = new RESBANANRC ()//here to manually new under public RESBANANRC Getmodel () {return RESBANANRC;   public void Execeute () {System.out.println ("name:" + resbananrc.getname ()); }   }
2. Using the properties of the action
Define the parameters to receive in the action and create the Getter,setter method, which, like the name of the parameter passed over, is not used as a conversion of the data type. The corresponding submission method can be used with get and post, such as: Testaction? Name=admin

View plain public class Testaction extends baseaction{
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.