Struts environment Configuration
1. Eclipse
Download URL: http://www.eclipse.org/
2. Tomcat
Download URL: http://jakarta.apache.org/site/binindex.cgi
3. Struts
Download URL: http://jakarta.apache.org/site/binindex.cgi
4. Tomcat for Eclipse plug-in
Download URL: http://www.sysdeo.com/eclipse/tomcatPlugin.html
5. Easy struts plug-in
Download URL: http://sourceforge.net/projects/easystruts
6. EJB development tool lomboz (not required)
Download URL: http://www.objectlearn.com/
Copy com. sysdeo. Eclipse. tomcat_2.2.1 in the preceding 4 and COM. Cross. easystruts. eclipse_0.6.4 in the preceding 5
Eclipse/plugins/, and then perform the following settings
1. Tomcat initialization settings: Start eclipse and open the setting window from windows to preferences.
Select Tomcat and configure
1. Easy struts initialization settings: Start eclipse and open the setting window from windows to preferences.
Select Struts 1.1 and find and add the Struts. jar file in the library file required by Struts 1.1.
3. In the Type Library description file required by Struts 1.1, we recommend that you add at least the three description files mentioned above:
Struts_html.tld, struts_bean.tld, struts_logic.tld, these three files will be automatically copied to the project's WEB-INF directory when creating the struts application project.
4. Create a tomcat project, right-click Project-> properties-> libraries, and add all the packages in Struts 1.1
5. Create add easy struts support
6. Copy all the packages in Struts 1.1 to the project-> WEB-INF/lib/
Use Java to connect to SQL Server 2000 to obtain data
1. Download The JDBC for sqlserver DRIVER:
Http://www.microsoft.com/downloads/details.aspx? Familyid = 4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae & displaylang = en # filelist
Click setup.exe to download the driver.
2. After the installation starts, use the default settings to install the SDK:
C:/program files/Microsoft SQL Server 2000 driver for JDBC
3. Run C:/program files/Microsoft SQL Server 2000 driver for JDBC/lib
The following MSSQLServer. jar, msbase. jar, and msutil. Jar files are copied to your
Under the JDK main directory/JRE/lib/EXT, now the JDBC driver is configured
4. Compile and run the test program:
String drivername = "com. Microsoft. JDBC. sqlserver. sqlserverdriver ";
String connurl = "JDBC: Microsoft: sqlserver: // bluesky: 1433; user = sa; Password = sa; databasename = sitedb ";
Try {
Class. forname (drivername );
Connection conn = drivermanager. getconnection (connurl );
Statement stmt = conn. createstatement ();
Stringbuffer strsql = new stringbuffer ();
Strsql. append ("select * From usertable where username = '" + username + "'");
Resultset rs = stmt.exe cutequery (strsql. tostring ());
If (! Rs. Next () |! Password. Equals (nulltostring (Rs. getstring ("password"). Trim ())){
Dbmsg = "sorry, the user you entered does not exist or the user password is incorrect ";
} Else {
Username = nulltostring (Rs. getstring ("username "));
Selectright = nulltostring (Rs. getstring ("selectright "));
Deleteright = nulltostring (Rs. getstring ("deleteright "));
Updateright = nulltostring (Rs. getstring ("updateright "));
}
} Catch (classnotfoundexception ex ){
Ex. printstacktrace ();
} Catch (sqlexception ex ){
Ex. printstacktrace ();
}
Now we can start Struts !!!