SSH learning-Spring basics and sshspring Basics1. What is the Spring framework?
Spring is a J2EE application framework and a lightweight container framework for IOC and AOP. It is a lightweight container for managing the lifecycle of javaBean. It can be used independently or with the Struts framework, hibernate framework.2. Advantages and disadvantages of the Spring framework:
Advantages:
Lightweight cont
Linux basics-network configuration, host name setting, ssh Login, scp transmission, sshscp
1. Network Configuration Modification
1. Temporary modification (ip, dns, netmask, gateway)
Temporarily modify the network configuration. If the configuration file is not modified, all the settings will become invalid after the network service is restarted.
2. Permanent modification (ip, dns, netmask, gateway)
Modif
all UNIX platforms-including HP-UX, Linux, AIX, Solaris, Digital UNIX, Irix, and other platforms-can run SSH.Normal SSH login need to enter the host password each time, in order to facilitate frequent landing, you can generate a key for the client machine and server to avoid the secret loginFour. SCP Transfer fileFive. Modify the SSH service default port and verify AccessResources1. Http://baike.baidu.com/
manualEditSed non-interactive text editingVI VI text EditorView launches VI text Editor in read-only modeVim Vim Text EditorFilechmod changing file permissions for a file or directoryCP copy file; copy directoryDu displays the amount of disk space used by the fileFind searches the directory tree for files, processing the resultsLN creates a new link to the fileLocate searching for filesLS displays various types of information for the fileMkfifo Creating Named PipesMV Move or rename files or dir
SSH is fully known as secure shell. It is a protocol developed by the Network Working Group of the IETF (Internet Engineering Task Force, the objective is to provide secure remote logon and other security network services on a non-secure network. We can simply understand it as an alternative solution such as rlogin and telnet. See the following SSH framework for details.
Saveorupdate () method, Cascade saves all the associated new temporary objects, and cascade updates all associated free objects.3, persist: When the session through the persist () method to save the current object, Cascade saves all the associated new temporary objects.4. Merge: When the current object is saved through the merge () method of the session, all associated free objects are cascaded.5. Delete: When you delete the current object through Delete (), all associated objects are cascaded.
above configuration is just a rack to turn this support on. and the default support for spring,Defined in the Org.apache.struts2.default.properties4.SSH IntegrationGuide PackageIntegrate Hibernate with springUsing spring to integrate Hibernate, complete the DAO interface and implementation classes, please refer to the steps of Spring integration hibernate.Using spring to integrate STRUTS2Use spring to integrate the STRUTS2 to complete the processing
Server database dialect, as well as the table, whether to display SQL statements, the last Then we write a test class to implement:Package Cn.itcast.hibernate;import Java.util.date;import Org.hibernate.session;import org.hibernate.SessionFactory ; import Org.hibernate.transaction;import Org.hibernate.cfg.configuration;import cn.itcast.hibernate.domain.User; public class Base {public static void main (string[] args) {Configuration cfg = new Configuration (); Cfg.configure (); Sessionfactory SF =
-update: When the session is saved or updated by the Save (), update (), Saveorupdate () method, the Cascade saves all the newly created temporary objects associated with the object. Also, cascade updates all associated free objects.3, persist: When the session through the persist () method to save the current object. The newly created temporary objects that are all associated with the Cascade are saved.4. Merge: When the current object is saved by the merge () method of the session. Cascade dis
container will only create a unique instance. This single instance is stored in the singleton cache (singleton cache), and all subsequent requests and references to the bean will return the cached object instance. 2,.prototypeWhen the bean's scope is set to prototype, the Spring IOC container creates a new bean instance each time the bean is requested.Iv. Scope of the bean1, when the scope of the Bean is a singleton (scope= "singleton" or no scope attribute)When the container is instantiated, t
inherited, so that the user can change the tool class things. So generally we will use Finalkeyword.Package Cn.itcast.hibernate;import Org.hibernate.session;import Org.hibernate.sessionfactory;import Org.hibernate.transaction;import Org.hibernate.cfg.configuration;public Final class Hibernateutil {private static Sessionfactory sessionfactory;private Hibernateutil () {}static{configuration cfg = new Configuration (); Cfg.configure ( ); sessionfactory = Cfg.buildsessionfactory ();} public static
, SQL Server database dialect, as well as the table, whether to display SQL statements, the last Then we write a test class to implement:Package Cn.itcast.hibernate;import Java.util.date;import Org.hibernate.session;import org.hibernate.SessionFactory ; import Org.hibernate.transaction;import Org.hibernate.cfg.configuration;import cn.itcast.hibernate.domain.User; public class Base {public static void main (string[] args) {Configuration cfg = new Configuration (); Cfg.configure (); Sessionfactory
.setname ("Emp3 name"); Emp3.setskill ("I am doing Java development"); s = hibernateutil.getsession (); tx = S.begintransaction (); S.save (EMP2); S.save (Emp3); Tx.commit (); } finally{ if (s!=null) { s.close (); } }}} Then, let's look at the tables in the database:As you can see, we just got two tables: the skill table and
= User.class;//user user = (user) S.get (userclass, id); User user = (user) S.load (userclass, id);//load value cannot be empty return user;} Finally{if (s!=null) {s.close ();}}This code will report an exception. Org.hibernate.LazyInitializationException:could not initialize Proxy-no Session.Because the database is not used at this time.If on the top user user = (user) s.load (userclass,id), this line of code is added below:System.out.println (User.getname ()); The exception is not reported at
very many update statements to tell the student which class. 2 . When we set classesidnot-null= "true", we will not be able to save the data, the resolved method we changed to bidirectional Association mapping. One-to-many association mappings (bidirectional)In order to solve a one-to-many problem, we use a two-way pair. Each party is able to maintain each other.Rather than demand-drivenOne-to-many bidirectional correlation mapping:* Use * Use ! ~ Note Classes Mapping FilesStudent Mapping Files
interface and the criteria interface: responsible for the implementation of various database queriesNote: The configuration instance is an object during startup, and once Sessionfactory is created it is discarded.Advantages/Disadvantages of hiberanate:Advantages:1. More ObjectWith the object-based thinking operation database, we only need to manipulate the object to be able, the development is more object-based.2. Transplant SexBecause Hibernate does a persistent layer of encapsulation, you don
for the original type, and if the match is automatically assembled;Here are just a few examples of using @resource:The code is the same as above, just Personservicebean.java changed:public class Personservicebean implements Personservice {@Resource (name= "Persondao") private Persondao Persondao; Private String name;public Persondao Getpersondao () {return persondao;} public void Setpersondao (Persondao persondao) {This.persondao = Persondao;} Public String GetName () {return name;} public void
Author: atomic_age Compilation
Introduction
In recent years, a large number of SSH-based malicious logon attack records have emerged in some network logs. This article uses the honeypot trap to analyze such attacks. Finally, this article provides some suggestions on how to prevent such attacks.
Research on the use of Honeypot
The New Zealand Honeynet alliance, a branch of the New Zealand Honeynet alliance, focuses on studying hacker behavior, attack m
was created when the container was initialized;The instance is created the first time it is fetched from the container, and if it gets again, the object that was the last created Singleton5.3. Initialization and destruction methodsInit-method= ""Initializes the method, executes the initialization method after the object is created; If it is a singleton, execute once; multiple executionsDestroy-method= ""Execute when calling the Destroy method of the Classpathxmlapplicationcontext Object!6.Bean
1, based on Struts2,spring3,hibernate3
2, SSH corresponding to the struts spring hibernatestruts using MVC mode, mainly acting on user interaction
Spring uses the IOC and aop~ functions to be more abstract and loosely coupled for projects
Hibernate is the object persistence framework, actually is the entity class and the database table establishes the relation, the Operation class will trigger the corresponding SQL statement, may not write any SQL sta
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.