Struts學習筆記 Bean標籤庫學習

2021-03-31 17:47:27 字數 3118 閱讀 7887

bean標籤庫

1. #0968f7

custlang" name="accept-language"/>

here: custlang"/>

=>

here: zh-**,en-us;q=0.5

2.

bookid" name="id" value="0"/><%--value是預設值-%>

請求的圖書編號為: bookid"/>

=>

請求的圖書編號為: 8

custnames" multiple="true"

name="names" value="hehe"/>

請求的客戶姓名有:

<%

for( int i = 0 ; i < custnames.length; i++ )

%>

=>

請求的客戶姓名有:

cheyo__vsftpd__google__

3.

cookies: customer" name="custname" value="cheyo"/>

您好,customer" property="value"/

>

=>

cookies: 

您好,cheyo

4.

>

=>

5.

<1>

<2>

<%

request.setattribute("stringbean", "test.nick");

%>

stringbean"/>

<3>

<%

somebean bean = new somebean();

bean.setname("hello");

request.setattribute("somebean", bean);

%>

somebean" property="name"/>

<4>

6.

以下為test頁面的內容:

testpage"  name="test/testds.jsp"/>

testpage"/>

7.

successforward" forward="aaaa"/>

successforward" property="path"/>

=>

/hello.jsp

8.

以下為include進的內容:

includereg" forward="success"/>

includereg" filter="false" />

以下為include進的內容3:

includereg" page="/hello.jsp"/><%--一定要以/開頭--%>

includereg" filter="false" />

9.

<1>

currdate" value="2005-03-28"/>

currdate"/>

<2>

<%

user user = new user();

user.setusername("cheyo");

request.setattribute("userbean", user);

%>

curruser

" name="userbean"/>

當前使用者姓名: curruser

" property="username"/>

<%-- 注意: 上面加下劃線的"user"這一變數名不應與紅色下劃線的"curruser"這一變數名相同! 否則會報錯! -->

10.

<%

hashmap lines = new hashmap();

lines.put("1", "line1");

lines.put("2", "line2");

lines.put("3", "line3");

request.setattribute("lines", lines);

%>

linesize" name="lines"/>

線的數量:

linesize"/>

11.

<1>

<%

request.setattribute("floatval", float.valueof("3.14159"));

calendar gc = gregoriancalendar.getinstance();

gc.settime(new date(session.getcreationtime()));

request.setattribute("now", gc);

%>

pi is : #.####" name="floatval"/>

session started at: mm-dd-yyyy hh:mm:ss" name="now" property="time"/>

<2>

<%

string boldstart = "";

string boldend = "";

request.setattribute("bs", boldstart);

request.setattribute("be", boldend);

%>

bs"/>哈哈哈哈be"/><%--輸出哈哈哈哈--%>

bs" filter="false"/>加粗的哈哈哈哈be" filter="false"/>

=>

哈哈哈哈

加粗的哈哈哈哈

struts2學習複習標籤(select 標籤)

struts2 select標籤的用法 struts2的select標籤中,常用的有以下幾個屬性 1 struts2中的select 標籤中,必須設定的屬性只有一個,即是list。2 select標籤的list中必須有值,不然會報錯。如果沒有值,可以加上headerkey,headervalue,這...

struts 學習筆記

1 struts大致流程 2 struts的mvc的思想很重要,主要是實現c的部分。就是控制器。3 簡單瞭解struts的標籤庫。最主要的還是要了解el和jstl表示式。測試c out hello default hello el表示式 hello default 123 hello default...

Spring 學習筆記 (三) Bean

配置 例項化 裝配 注入不同資料型別 基於annotation 定義 bean 標註在實現類上 bean 元件裝配 標註在屬性變數,屬性的 setter 方法,構造方法上 載入註解定義的 bean 區別見 difference between contextannotation config and...

Struts學習筆記5

2.方法 public exceptionconfig findexception class type 查詢異常物件 public actionforward findforward string name public string findforwards 找到一個action可以使用的act...

struts學習筆記6

struts提供了三大常用標籤庫 html,bean,logic html標籤 用來代替普通標籤,支援自動回填功能 出錯時可以回填,修改時設定預設值也可以回填 bean標籤 顯示資料到頁面上,支援設定屬性功能,支援國際化 login標籤 迴圈判斷功能 1.logic標籤 判斷標籤一共6組,12個 l...