[color=red]struts1.x 標籤庫的配置[/color]
使用struts標籤之前需要經過下面3個步驟的配置。
[color=orange]匯入tld檔案。
在web.xml中註冊標籤庫。
在頁面中引入標籤庫。[/color]
下面詳細介紹以上步驟。
匯入tld檔案。
tld檔案是struts的標籤庫描述檔案,一般將其直接複製到應用工程的web-inf目錄下
在web.xml中註冊標籤庫。
01 02 /web-inf/struts-bean.tld
03 /web-inf/struts-bean.tld
04 05
06 /web-inf/struts-html.tld
07 /web-inf/struts-html.tld
08 09
10 /web-inf/struts-logic.tld
11 /web-inf/struts-logic.tld
12 [color=green]
根據struts版本的不同,在web.xml中註冊標籤庫這一步驟是可以省略的。[/color]
在頁面中引入標籤庫。
在jsp頁面中使用標籤引入某個標籤庫,並且給予它乙個對於該頁面有效的字首作為標記,那麼就可以通過其字首使用該標籤庫了。引入標籤庫的**如下:
01 <%@ taglib uri="/web-inf/struts-bean.tld" prefix="bean" %>
02 <%@ taglib uri="/web-inf/struts-html.tld" prefix="html" %>
03 <%@ taglib uri="/web-inf/struts-logic.tld" prefix="logic" %>
在上面**中,例如將bean標籤庫的字首定義為bean,則可通過字首bean來引用bean標籤庫了,示例如下:
01 <%@ taglib uri="/web-inf/struts-bean.tld" prefix="bean" %>
02 [color=darkred]struts 1.3.8的tld檔案內建在struts-taglib-1.3.8.jar中,只需要在jsp頁面中宣告類似如下即可:[/color]
<%@ taglib uri="" prefix="bean" %>
<%@ taglib uri="" prefix="html" %>
<%@ taglib uri="" prefix="logic" %>
[color=green]
或者將struts-taglib-1.3.8.jar解壓縮後將其中的tld檔案複製到web-inf目錄下,再按上述步驟配置。
[/color]
struts1 x 學習筆記
struts1.x 工作流程 2.建立actionform物件,儲存表單引數 3.使用actionform的validate方法進行引數驗證 4.actionservlet傳遞請求給相應的action 5.action的execute方法返回相應的actionforward物件 6.actionse...
struts 1 x 學習 筆記1
配置struts 1.x 要做的以下幾件事,1.匯入jar 2.web.xml配置actionservlet 3.struts conf.xml 4.配置formbean 5.配置action path 必須 type 必須 name 是frombean的名字 scope 作用域,只有session...
Struts1 x的validator框架使用
一 配置 在使用validator校驗框架時候先要對工程進行配置,新增validator rules.xml和validator.xml兩個檔案,將其放到web inf 目錄下 與web.xml檔案在同一目錄下 在struts config.xml中設定外掛程式 value值用來指定驗證規則的檔案,...