Struts Environment Configuration Hands (Eclipse), including SQL Server connection

xiaoxiao2021-03-06  58

Struts environment configuration hand

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 plugin

Download URL: http://www.sysdeo.com/eclipse/tomcatplugin.html

5.easy struts plugin

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 above 4 and the com.cross.easystruts.eclipse_0.6.4 of the above 5

Eclipse / Plugins /, then make the following settings

1. Tomcat initialization setting: Start Eclipse, open the settings window through the menu Windows-> Preferences

Select Tomcat and configure

1.Easy Struts Initialization Settings: Start Eclipse, open the settings window by menu Windows-> Preferences

Select Struts 1.1 and find the struts.jar file in the library file required for STRUTS 1.1.

3. In the type library description file required by Struts 1.1, it is recommended to join the three description files mentioned earlier:

Struts_html.tld, struts_bean.tld, struts_logic.tld, these three files are automatically copied to the project's web-inf directory when creating a struts application project.

4. Create a Tomcat project, then right-click Project-> Properties-> Libraries, join all the package in Struts 1.1 to / R

5. New Add Easy Struts Support

6. Put all the package in Struts 1.1 COPY to Project-> Web-INF / LIB /

Use Java to connect SQL Server 2000 to get data

1. Download the driver of JDBC for SQLServer:

http://www.microsoft.com/downloads/details.aspx?familyid=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&displaylang=en#filelist

Click Setup.exe download driver

2. After downloading, install it with the default settings, will be installed:

C: / Program Files / Microsoft SQL Server 2000 Driver for JDBC

3. Put C: / Program Files / Microsoft SQL Server 2000 Driver for JDBC / LIB

The following MSSQLSERVER. Jar, Msbase.jar, Msutil.jar three files copied to you

JDK home directory / jre / lib / ext, now JDBC driver is configured

4. Compile the running test program:

String drivername = "com.microsoft.jdbc.sqlserver.sqlserdriver";

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.executeQuery (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 = NullTString (rs.getstring ("selfway");

Deleteright = nulltostring (rs.getstring ("deleteright");

Updateright = nulltostring (rs.getstring ("Updateright");

}

} catch (classnotfoundexception ex) {

EX.PrintStackTrace ();

} catch (sqlexception ex) {

EX.PrintStackTrace ();

}

Next, you can start doing Struts !!!

转载请注明原文地址:https://www.9cbs.com/read-114577.html

New Post(0)