%--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-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 %>
|
|
|
<% } %>