Some days ago, college students asked me to help their company get a small project and analyze his needs. I thought it was very simple and agreed. It took a whole day to complete. There are also some gains, so you can quickly record the knowledge gained from the project and use it later.
Development Tool: jdk1.5 tomcat6.0 eclipse oracle10gxe
Framework: strust2.x spring3.x mybatis3.x foreground mainly jquery
The results are as follows:
1. As a persistent layer framework, mybatis has a null exception. For example
Sqlsession sqlseesion;
Users users = new users (); // user is a keyword, depressing
Users. setuname (null );
Users. setuage (20 );
Sqlsession. insert ("insertusers", users );
// Sqlsession is injected
// Mybatis Mapper. xml and spring XML configurations will not be written.
When you run the code, a null exception occurs. First, I thought about whether orcale data is not empty. The result is that it can be empty. For verification, an SQL statement is directly used to insert data successfully under orcale.
At this time, I thought it may be the problem of mybatis. maybe you would want to say that sqlsession may be empty. Of course, it was verified long ago and spring injection was successful.
If mybatis is always used, it is necessary to identify the problem in that link. If I modify the SQL statement in mapper directly, change # {uname} to null, run, and insert successfully.
This indicates that there may be a type conversion problem, that is, the reason why the javatype conversion fails to determine the type in jdbctype's null value. If so, I searched the internet and found many people
Also encountered the same problem. Some people say that it is okay to change null to "". But the solution is too direct to explore the problem itself. The final solution is as follows:
# {Uname }==># {uname, jdbctype = varchar}
2. tomcat6.0 deployment project problems
Let's talk about the solution.
A. D:/jdk1.5/bin to configure to the path of the Environment Variable
B. Configure java_home and jre_home in the environment variables. Later, I checked the information on the Internet and learned that these two environment variables are in atat6.0/bin/setclasspath. BAT was used, so someone proposed another solution. Write the two variables directly to setclasspath. bat.
Set java_home = D: \ jdk1.5
Set jre_home = D: \ jdk1.5 \ JRE
C. Run startup. bat.