解析Struts配置教程_JSP教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
推薦:解析簡單計數(shù)器的并發(fā)問題%@pagelanguage=javacontentType=text/html;charset=UTF-8 pageEncoding=UTF-8% EhtmlPUBLIC-//W3C//DTDHTML4.01TR/html4/loose.dtd html head metahttp-equiv=Content-Typecontent=text/html;charse
Struts框架是目前流行的JSP開發(fā)框架,本文就其進(jìn)行了基礎(chǔ)講解。首先下載Struts軟件包,到 http://struts.apache.org/下載Struts,Struts各版本的差異很大,這里已Struts1.2.9版本為例,解壓縮包內(nèi)容如下:
1、在tomcat安裝目錄下的webapps目錄中建立一個webjx目錄。這樣就可以通過訪問"http://localhost:8080/webjx"訪問"webjx"這個目錄。
2、在你創(chuàng)建的目錄webjx中,建立WEB-INF目錄,在WEB-INF中建立classes、lib和tld文件夾。將壓縮包struts-1.2.9-bin\lib文件夾中的 commons-*.jar(*代表任意位任意字符)和struts.jar文件拷貝到建立的 webjx/WEB-INF/lib目錄下,然后將Struts中的標(biāo)簽庫文件 struts-*.tld(*代表任意位任意字符)拷貝到 webjx/WEB-INF/tld目錄下
3、在webjx/WEB-INF/目錄下建立一個web.xml文件,文件內(nèi)容如下:
| <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"> <web-app> <display-name>Struts Blank Application</display-name> <!-- Standard Action Servlet Configuration (with debugging) --> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>application</param-name> <param-value>ApplicationResources</param-value> </init-param> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>2</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>2</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- Standard Action Servlet Mapping --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <!-- The Usual Welcome File List --> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <!-- Struts Tag Library Descriptors --> <taglib> <taglib-uri>/tags/struts-bean</taglib-uri> <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-html</taglib-uri> <taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-logic</taglib-uri> <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-nested</taglib-uri> <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-tiles</taglib-uri> <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location> </taglib> </web-app> |
4、在webjx/WEB-INF/目錄下建立一個struts-config.xml文件,文件內(nèi)容如下:
| <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd"> <struts-config> <form-beans> </form-beans> <global-forwards> </global-forwards> <action-mappings> </action-mappings> <message-resources parameter="ApplicationResources"/> </struts-config> |
分享:struts+spring實現(xiàn)的登陸實例源碼剛接觸Jsp的struts不久,又要學(xué)spring,然后把兩者結(jié)合起來用。于是我在網(wǎng)上找了很多的有關(guān)struts+spring的例子,但基本上都是a的例子,然后根據(jù)它的原理重新編寫一本書上用struts實現(xiàn)的例子。 一、運行環(huán)境 1、eclipse-SDK-3.2 2、MyEclipseGA5.0 3、apache-
相關(guān)JSP教程:
- jsp response.sendRedirect不跳轉(zhuǎn)的原因分析及解決
- JSP指令元素(page指令/include指令/taglib指令)復(fù)習(xí)整理
- JSP腳本元素和注釋復(fù)習(xí)總結(jié)示例
- JSP FusionCharts Free顯示圖表 具體實現(xiàn)
- 網(wǎng)頁模板:關(guān)于jsp頁面使用jstl的異常分析
- JSP頁面中文傳遞參數(shù)使用escape編碼
- 基于jsp:included的使用與jsp:param亂碼的解決方法
- Java Web項目中連接Access數(shù)據(jù)庫的配置方法
- JDBC連接Access數(shù)據(jù)庫的幾種方式介紹
- 網(wǎng)站圖片路徑的問題:絕對路徑/虛擬路徑
- (jsp/html)網(wǎng)頁上嵌入播放器(常用播放器代碼整理)
- jsp下顯示中文文件名及絕對路徑下的圖片解決方法
- 相關(guān)鏈接:
- 教程說明:
JSP教程-解析Struts配置教程
。