Struts学习笔记: Html标签库学习(Form标签)
2024-07-21 02:15:09
供稿:网友
html标签库(form部分)
1. <html:form>
<html:form action="/regguest"></html:form>
=>
<form name="regguestform" method="post" action="/addressbook/regguest.do">
2. <html:text>
<html:text property="name"/>
=>
<input type="text" name="name" value="">
3. <html:cancel>
<html:cancel>俺要立即取消操作!</html:cancel>
=>
<input type="submit" name="org.apache.struts.taglib.html.cancel" value="俺要立即取消操作!" >
action的execute中通过iscancel(request)来判断是否为cancel提交
4. <html:reset/>
<html:reset>重新填写</html:reset>
=>
<input type="reset" value="重新填写">
5. <html:submit>
<html:submit>偶要提交表单</html:submit>
=>
<input type="submit" value="偶要提交表单">
6. <html:hidden>
<html:hidden property="name"/><p/>
<html:hidden property="name" value="777"/><p/>
<html:hidden property="name" write="true"/><p/>
=>
<input type="hidden" name="name" value=""><p/>
<input type="hidden" name="name" value="777"><p/>
<input type="hidden" name="name" value=""><p/>
提交后的html:
<input type="hidden" name="name" value="fds"><p/>
<input type="hidden" name="name" value="777"><p/>
<input type="hidden" name="name" value="fds">fds<p/>
7. <html:checkbox>
<html:checkbox property="programlang"/>
=>
<input type="checkbox" name="programlang" value="on">
<html:checkbox property="programlang" value="true"/>
<%-- 如果用户选择了这个checkbox,则相应的formbean的programlang的值就为true --%>
=>
<input type="checkbox" name="programlang" value="true">