Java Knowledge Summary-24

Source: Internet
Author: User

SQL try not to splice precompiled mode/parameterized SQL
-----Prevent SQL Injection
--sql injection is the execution of a malicious SQL command by inserting a SQL command into a Web form to commit or entering a query string for a domain name or page request, eventually spoofing the server.


Force release Port
1, get the PID of the occupied port. Open cmd, command: Netstat-a-O.
2, forcibly released. Command: Ntsd-c q-p PID.


In Struts2 JSP
Generate hyperlink arguments in iterration with%{# X.name} can also be used in the URL tag with the "param" parameter

Web Multithreading security issues
Multi-Stroke Class Property location cannot place a property that needs to change the value
For example:
The use of Connection Statement ResultSet in JDBC is placed in the position of the class attribute (member variable) when multiple trip accesses if one thread gets Connection after blocking another thread runs after replacing Connection use after closing the blocking thread Run the value to close the throw exception


Interface Name
IXXXX-----begins with I

When reading a database, it is sometimes necessary to turn on a transaction to prevent errors such as dirty read and false reading


Stringutil.join (List, ","); Concatenation of a set of comma-stitched output strings


Java Cross-platform automatic garbage collection


Learning Framework (Spring)
Entry procedure--dispatcherservlet
Core Configuration--[servlet-name]-servlet.xml
Control Logic--usercontroller


Servlet Three techniques: servlet filter Listener


Class. Class.getclassloader (). GetResource (""). GetPath ()--------Get the Directory of the class (implemented through the ClassLoader)


Read Db.properties file
InputStream Resourceasstream = JdbcUtil.class.getClassLoader (). getResourceAsStream ("db.properties");
Loading the contents of the Db.properties file into info
Info.load (Resourceasstream);
-------------Read and load the resource file Db.properties


A Java file can write more than one class but the permissions of the class are only public default two kinds
A Java file can have more than one Java class Java file name must be the same as the public class name in the file, so a Java file class has only one public

Class of common method extraction for slices
Methods for notifying slice classes
The pointcut adds the notification to the target class's location
Weave in to add notice to the entry point

Integration steps
Persistent layer-to-DAO layer--Service layer---> Action layer
1. Create a project import jar to establish a basic backage
3. Set up Database write JavaBean

Java Knowledge Summary-24

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.