<html:link page="/html-link.do">
Linking with the page attribute. </html:link> |
<html:link href="/struts-exercise-taglib/html-link.do">
Using Href </html:link> |
<html:link href="http://otherserver/strutsTut/html-link.do">
Using Href </html:link> |
<html:link action="/html-link">
Using Action attribute </html:link> |
<html:link page="/htmllink.do?doubleProp=3.3&longProp=32">
Double and long via hard coded changes </html:link> |
<html:link page="/html-link.do" paramId="booleanProperty" paramName="testbean"
paramProperty="nested.booleanProperty"> Boolean via paramId, paramName, and paramValue </html:link> |
<a href="/struts-exercise-taglib/html-link.do?booleanProperty=false">
Boolean via paramId, paramName, and paramValue </a> |
<%
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); %> ... <html:link action="/html-link" name="newValues"> Float, int, and stringArray via name (Map) </html:link> |
<html:messages property="property2" message="true" id="msg" header="messages.header" footer="messages.footer">
<tr><td><%= pageContext.getAttribute("msg") %></td></tr> </html:messages> |
标签?/span>
|
说明
|
HTML 标签
|
用来创徏能够?/span>Struts 框架和其他相应的HTML 标签交互?/span>HTML 输入表单
|
Bean 标签
|
在访?/span>JavaBeans ?qing)其属性,以及(qing)定义一个新?/span>bean 时?/span>
|
Logic 标签
|
理条g产生的输出和对象集生的循环
|
Template 标签
|
随着Tiles框架包的出现Q此标记已开始减?/span>
|
Nested 标签
|
增强对其他的Struts 标签的嵌套用的能力
|
属?/span>
|
说明
|
id
|
命名自定义标{ֈ建时的脚本变量名?/span>
|
name
|
指出关键字|在该关键字下可以扑ֈ一个存在的bean 。如果给Zscope属性,则仅仅在scope中查找。否则,Ҏ(gu)标准的顺序在各种scope中查找:(x)(page, request, session, or application)?/span>
|
property
|
指出bean 中的某个属性,可以在其中检索倹{如果没有标明,则用对象本w的倹{?/span>
|
scope
|
定义?/span>Bean在哪个范?/span>(page, request, session, or application)中被查找。如果没有标明按序查找。脚本变?/span>(?/span>id)在相同的范围中创徏?/span>
|
Property="foo.bar.baz"
q相当于q行下面的调用:(x) getFoo().getBar().getBaz()Q?/span> 或者做?/span>setterQ?/span> getFoo().getBar().setBaz(value)Q?/span> |
错误Q?/span>
<html:link href="'<%= "/" + name %>/index.jsp>'> 正确Q?/span> <html:link href="'<%= "/" + name + "/index.jsp" %>'> // 表达式必L供整个属性?/span> |
<html:html locale=\"true\">
此行代码解析后:(x) <html lang=\"en\"> |
<html:base/>
此行代码解析后:(x) <base href=\"http://www.mymain.com/myStrutsApp/testing.jsp\"> |
<html:img page=\"/logo.gif\" height=\"50\" width=\"200\" alt=\"Web Logo\"/>
|
<html:link page=\"/index.html\">Click demo</html:link>
此行代码解析后:(x) <a href=\"/index.html\">Click demo</a> |
<html:form action=\"/login\" >
如果你有上述一个标{?/span> Q那么你?/span>Struts配置文g的元素中必须有一个如下显CZؓ(f)_体的元素:(x) <action-mappings> <action path=\"/login\" type=\"com.javapro.struts.LoginAction\" name=\"loginForm\" scope=\"request\" input=\"/login.jsp\"> <forward name=\"success\" path=\"/mainMenu.jsp\"/> </action> . . . </action-mappings> // q就是说一?/span>form标签是和form bean相关联的?/span> |
<body>
<html:form action=\"/login\" focus=\"password\"> User Name: <html:text property=\"userName\"/> <br>Password: <html:text property=\"password\"/> <br><html:submit/> </html:form> </body> 代码解析后:(x) <body> <form name=\"loginForm\" method=\"post\" action=\"/myStrutsApp/login.do\"> User Name: <input type=\"text\" name=\"userName\" value=\"\"> <br>Password: <input type=\"text\" name=\"password\" value=\"\"> <br><input type=\"submit\" value=\"Submit\"> </form> <script language=\"JavaScript\" type=\"text/javascript\"> <!-- if (document.forms[\"loginForm\"].elements[\"password\"].type != \"hidden\") document.forms[\"loginForm\"].elements[\"password\"].focus() // --> </script> </body> |
<html:password property=\"password\" redisplay=\"false\"/>
|
<html:select property=\"color\" size=\"3\">
<html:option value=\"r\">red</html:option> <html:option value= \"g\">green</html:option> <html:option value= \"b\">blue</html:option> </html:select> |