Configure struts Environment [eclipse]

Source: Internet
Author: User
Tags tld
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 !!!

Related Article

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.