1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<html:html>
<head>
<title>Test html:link Tag</title><%
String newValue = "New string value";
pageContext.setAttribute("newValue", newValue);
java.util.HashMap newValues = new java.util.HashMap();
newValues.put("floatProperty", new Float(444.0));
newValues.put("intProperty", new Integer(555));
newValues.put("stringArray", new String[]
{ "Value 1", "Value 2", "Value 3" });
pageContext.setAttribute("newValues", newValues);
%>
</head>
<body>
<div align="center">
<h1>Test struts-html Link Tag</h1>
</div>
<p>The following links should hyperlink back to this page, with various combinations of request parameters used to modify the previous values of the associated form bean. Press the "Cancel" button to return to the main menu.</p>
<html:form action="/html-link-submit">
<table border="0" width="100%">
<tr>
<th colspan="4" align="center">Current Values</th>
</tr>
<tr>
<th align="right">booleanProperty</th>
<td align="left">
<html:checkbox property="booleanProperty" />
</td>
<th align="right">intProperty</th>
<td align="left">
<html:text property="intProperty" size="16" />
</td>
</tr>
<tr>
<th align="right">doubleProperty</th>
<td align="left">
<html:text property="doubleProperty" size="16" />
</td>
<th align="right">longProperty</th>
<td align="left">
<html:text property="longProperty" size="16" />
</td>
</tr>
<tr>
<th align="right">floatProperty</th>
<td align="left">
<html:text property="floatProperty" size="16" />
</td>
<th align="right">stringProperty</th>
<td align="left">
<html:text property="stringProperty" size="16" />
</td>
</tr>
<tr>
<th align="right">stringArray</th>
<td align="left" colspan="3">
<html:text property="stringArray[0]" size="16" />
<html:text property="stringArray[1]" size="16" />
</td>
</tr>
<tr>
<th colspan="4" align="center">Hyperlinks To Be Tested via page attribute</th>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link-submit">No modifications at all</html:link>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link-submit?doubleProperty=321.321&longProperty=321321">Double and long via hard coded changes</html:link>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link-submit" paramId="stringProperty" paramName="newValue">String via paramId and paramName</html:link>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link-submit" paramId="booleanProperty" paramName="testbean" paramProperty="nested.booleanProperty">Boolean via paramId, paramName, and paramValue</html:link>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link-submit" name="newValues">Float, int, and stringArray via name (Map)</html:link>
</td>
</tr>
<tr>
<tr>
<th colspan="4" align="center">
Hyperlinks To Be Tested via action and module attributes
</th>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link">
No modifications at all, but link to the default module.
</html:link>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link?doubleProperty=321.321&longProperty=321321"
module="/exercise">
Double and long via hard coded changes (module)
</html:link>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link"
paramId="stringProperty" paramName="newValue">
String via paramId and paramName
</html:link>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link"
paramId="booleanProperty"
paramName="testbean" paramProperty="nested.booleanProperty"
module="/exercise">
Boolean via paramId, paramName, and paramValue (module)
</html:link>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<html:link action="/html-link"
name="newValues">
Float, int, and stringArray via name (Map)
</html:link>
</td>
</tr>
<tr>
<th colspan="4" align="center">Reset and Cancel Buttons</th>
</tr>
<tr>
<td colspan="4" align="center">
<html:reset>Reset</html:reset>
<html:cancel>Cancel</html:cancel>
</td>
</tr>
</table>
</html:form>
<p>The following list tests relative, context-relative, and absolute links. Press (back) to return.</p>
<p>Forwards</p>
<ul>
<li>
<html:link forward="relative">module welcome page</html:link>
</li>
<li>
<html:link forward="context-relative">application welcome page (context relative attribute)</html:link>
</li>
<li>
<html:link forward="module-root">application welcome page (module attribute)</html:link>
</li>
<li>
<html:link forward="module-validator">validator welcome page</html:link>
</li>
<li>
<html:link forward="absolute">Struts website</html:link>
</li>
<li>
<html:link forward="redirect-default">Redirect to the default page ("/")</html:link>
</li>
</ul>
<p>Actions</p>
<ul>
<li>
<html:link action="/welcome" module="/">application welcome page</html:link>
<!-- Test with empty string for module: <html:link action="/welcome" module="">application welcome page</html:link> -->
</li>
<li>
<html:link action="/welcome" module="/exercise">Exercise module welcome page</html:link>
</li>
<li>
<html:link action="/upload" module="/upload">Upload welcome page</html:link>
</li>
<li>
<html:link action="/welcome" module="/validator">Validator welcome page</html:link>
</li>
</ul>
<p>Pages</p>
<ul>
<li>
<html:link page="/welcome.do" module="">application welcome page</html:link>
<%-- FIXME: "/" slash throws NPE: <html:link page="/welcome.do" module="/">application welcome page</html:link> --%>
</li>
<li>
<html:link page="/welcome.do" module="/exercise">Exercise module welcome page</html:link>
</li>
<li>
<html:link page="/upload.do" module="/upload">Upload welcome page</html:link>
</li>
<li>
<html:link page="/welcome.do" module="/validator">Validator welcome page</html:link>
</li>
</ul>
</body>
</html:html>
|