Struts環境配置手冊

來源:互聯網
上載者:User
基於SQL Server資料庫的Struts開發配置手冊,測試通過。
1.Eclipse
 下載網址:  http://www.eclipse.org/

2.tomcat
 下載網址:  http://jakarta.apache.org/site/binindex.cgi

3.struts
 下載網址:  http://jakarta.apache.org/site/binindex.cgi

4.tomcat for Eclipse外掛程式
 下載網址:  http://www.sysdeo.com/eclipse/tomcatPlugin.html

5.easy struts外掛程式
 下載網址:  http://sourceforge.net/projects/easystruts

6.EJB開發工具lomboz(不是必需的)  
 下載網址:  http://www.objectlearn.com/

把上述4中的com.sysdeo.eclipse.tomcat_2.2.1和上述5中的com.cross.easystruts.eclipse_0.6.4分別COPY到
eclipse/plugins/,然後進行以下設定

1.Tomcat的初始化設定:啟動Eclipse,通過菜單Windows->Preferences開啟設定視窗
 選擇Tomcat並做配置
1.Easy Struts的初始化設定:啟動Eclipse,通過菜單Windows->Preferences開啟設定視窗
 選擇struts 1.1並在struts 1.1所需的庫檔案中找到並添加struts.jar檔案
3.在struts 1.1所需的類型庫描述檔案中建議至少加入前面提到的三個描述檔案分別是:
 struts_html.tld、struts_bean.tld、struts_logic.tld,這三個檔案會在建立struts應用項目時自動拷貝到項目的WEB-INF目錄下。
4.建立一個Tomcat項目,然後右擊project->Properties->Libraries,把struts 1.1中的包全部加入
5.建立Add Easy Struts Support
6.把struts 1.1中的包全部COPY到project->WEB-INF/LIB/

用JAVA串連SQL Server 2000取得資料
1.下載JDBC FOR SQLSERVER 的驅動:
http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&DisplayLang=en#filelist
點擊setup.exe下載驅動
2.下載後開始安裝,就用預設設定安裝,會被安裝到:
  C:/Program Files/Microsoft SQL Server 2000 Driver for JDBC
3.把C:/Program Files/Microsoft SQL Server 2000 Driver for JDBC/lib
 下面的mssqlserver.jar,msbase.jar,msutil.jar三個檔案拷貝到你的
  JDK主目錄/jre/lib/ext下面,現在JDBC驅動就算配置好了
4.編譯運行測試程式:
       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 = "對不起,您所輸入的使用者不存在或使用者密碼不正確";
       }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();
       }

struts!!go!!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.