Struts1.2.4 learning experience! (2)

xiaoxiao2021-03-06  59

Second study: 1. View the resource file tag. For use: can use <% = WebXML%> and

Display <% = WebXML%> Display is that HTML is not converted <>, can. 2. Calculate the size tag of the collection. Such as use:

Java code:

1

2 <%

3 java.

Util.

ArrayList Data =

New java.

Util.

ArrayList

(

);

4 DATA.

Add

("First"

);

5 DATA.

Add

("SECOND"

);

6 DATA.

Add

("Third"

);

7 DATA.

Add

("Fourth"

);

8 DATA.

Add

("Fiffh"

);

9 PageContext.

SetaTribute

("List", DATA, PageContext.

Page_scope

);

10%>

11

After defining a collection. Use the

Boolean,

New

Boolean

(

True

)

);

4 PageContext.

SetaTribute

("TEST1.

Double ",

New

Double

(

321.

0

)

);

5 pageContext.

SetaTribute

("TEST1.

Float,

New

Float

(

(Float)

)

123.

0

)

);

6 pagecontext.

SetaTribute

("TEST1.

Int "

New

Integer

(

123

)

);

7 pagecontext.

SetaTribute

("TEST1.

"

New

Long

(

321

)

);

8 PageContext.

SetaTribute

("TEST1.

SHORT ",

New

Short

(

(Short)

)

987

)

);

9 PageContext.

SetaTribute

("TEST1.

String "," this is a string "

);

10%>

11

Displayed in the following manner: Boolean: <% = pageContext.getattribute ("test1.boolean")%> or Double: <% = pagecontext.getattribute ("TEST1 .double ")%> or ........................ Data taken from Bean, the method is the same, such as: instantiation a bean : is displayed in the following manner: Boolean: or Double: or

转载请注明原文地址:https://www.9cbs.com/read-113262.html

New Post(0)