%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
Test struts-bean:write Tag
Test struts-bean:write Tag
Test 1 -- Scalar Variable Lookups
<%
pageContext.setAttribute("test1.boolean", new Boolean(true));
pageContext.setAttribute("test1.double", new Double(321.0));
pageContext.setAttribute("test1.float", new Float((float) 123.0));
pageContext.setAttribute("test1.int", new Integer(123));
pageContext.setAttribute("test1.long", new Long(321));
pageContext.setAttribute("test1.short", new Short((short) 987));
pageContext.setAttribute("test1.string", "This is a string");
%>
Data Type |
Correct Value |
Test Result |
boolean |
<%= pageContext.getAttribute("test1.boolean") %>
|
|
double |
<%= pageContext.getAttribute("test1.double") %>
|
|
float |
<%= pageContext.getAttribute("test1.float") %>
|
|
int |
<%= pageContext.getAttribute("test1.int") %>
|
|
long |
<%= pageContext.getAttribute("test1.long") %>
|
|
short |
<%= pageContext.getAttribute("test1.short") %>
|
|
String |
<%= pageContext.getAttribute("test1.string") %>
|
|
Test 2 -- Scalar Property Lookups
Data Type |
Correct Value |
Test Result |
boolean |
|
|
double |
|
|
float |
|
|
int |
|
|
long |
|
|
short |
|
|
String |
|
|
Test 3 - Integer Array And Indexed Lookups
Correct Value |
Array Result |
Indexed Result |
<% for (int index = 0; index < 5; index++) { %>
<%= index * 10 %>
|
|
|
<% } %>
Test 4 - String Array And Indexed Lookups
Correct Value |
Array Result |
Indexed Result |
<% for (int index = 0; index < 5; index++) { %>
<%= "String " + index %>
|
|
|
<% } %>
Test 5 -- Nested Scalar Property Lookups
Data Type |
Correct Value |
Test Result |
boolean |
|
|
double |
|
|
float |
|
|
int |
|
|
long |
|
|
short |
|
|
String |
|
|
Test 6 - Nested Integer Array And Indexed Lookups
Correct Value |
Array Result |
Indexed Result |
<% for (int index = 0; index < 5; index++) { %>
<%= index * 10 %>
|
|
|
<% } %>