Struts Environment Configuration Guide [Eclipse]

Source: Internet
Author: User
Tags sql server driver stmt tld stringbuffer
Struts Environment Configuration Guide [Eclipse]
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
http://struts.apache.org/download.cgi#struts206
4.tomcat for Eclipse Plug-in
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 each of the above 4 com.sysdeo.eclipse.tomcat_2.2.1 and the com.cross.easystruts.eclipse_0.6.4 in the above 5 to
Eclipseplugins, and then make the following settings
1.Tomcat initialization settings: Start Eclipse, open the Settings window via menu windows->preferences
Select Tomcat and do the configuration
1.Easy initialization settings for struts: Start Eclipse, open the Settings window via menu windows->preferences
Select Struts 1.1 and locate and add the Struts.jar file in the library files required for Struts 1.1
3. In the type library description required for Struts 1.1, it is recommended that at least the three described documents mentioned above be added to:
Struts_html.tld, Struts_bean.tld, Struts_logic.tld, these three files are automatically copied to the project's Web-inf directory when the Struts application project is created.
4. Create a new Tomcat project, then right-click Project->properties->libraries and add all of the packages in Struts 1.1
5. New Add Easy Struts Support
6. Copy all of the packages from Struts 1.1 to Project->web-inflib
Get data with Java Connection SQL Server 2000
1. Download the JDBC for SQL Server driver:
Http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&DisplayLang=en#filelist
Click setup.exe Download Driver
2. Install after downloading, install with default setting, will be installed to:
C:Program FilesMicrosoft SQL Server Driver for JDBC
3. C:Program FilesMicrosoft SQL Server Driver for Jdbclib
The following Mssqlserver.jar,msbase.jar,msutil.jar three files are copied to your
JDK Home directory Jrelibext below, JDBC driver is now 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.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 = nulltostring (rs.getstring ("Selectright"));
Deleteright = nulltostring (rs.getstring ("Deleteright"));
Updateright = nulltostring (rs.getstring ("Updateright"));
}
}catch (ClassNotFoundException ex) {
Ex.printstacktrace ();
}catch (SQLException ex) {
Ex.printstacktrace ();
}
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.