常用的HTML标签有:
<html:base /> <html:text /> <html:password />
<html:radio /> <html:select /> <html:checkbox />
<html:textarea /> <html:form /> <html:submit />
<html:reset />
1、<html:base />
<html:base />
替换
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>">
2、<html:text />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:text name="per" property="name" />
3、<html:password />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:password name="per" property="name" />
4、<html:radio />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:radio name="per" property="name" value="male">男</html:radio>
<html:radio name="per" property="name" value="female">女</html:radio>
5、<html:select />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:select name="per" property="city">
<html:option value="北京">北京</html:option>
<html:option value="大庆">大庆</html:option>
<html:option value="哈尔滨">哈尔滨</html:option>
</html:select>
6、<html:checkbox />和<html:multibox />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:multibox name="per" property="city" value="哈尔滨"/>哈尔滨
<html:multibox name="per" property="city" value="大庆"/>大庆
<html:multibox name="per" property="city" value="北京"/>北京
注意:<html:checkbox />无法设置默认值,可以通过<html:multibox />代替.
7、<html:textarea />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:textarea name="per" property="name"></html:textarea>
8、<html:form />
注意:
<html:form />必须和一个具体的ActionForm绑定.它是如何找到需要绑定的那个ActionForm呢?
答案:Action------>ActionForm
9、<html:submit />和<html:reset />
对应HTML中的 submit 和 reset
<html:base /> <html:text /> <html:password />
<html:radio /> <html:select /> <html:checkbox />
<html:textarea /> <html:form /> <html:submit />
<html:reset />
1、<html:base />
<html:base />
替换
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>">
2、<html:text />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:text name="per" property="name" />
3、<html:password />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:password name="per" property="name" />
4、<html:radio />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:radio name="per" property="name" value="male">男</html:radio>
<html:radio name="per" property="name" value="female">女</html:radio>
5、<html:select />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:select name="per" property="city">
<html:option value="北京">北京</html:option>
<html:option value="大庆">大庆</html:option>
<html:option value="哈尔滨">哈尔滨</html:option>
</html:select>
6、<html:checkbox />和<html:multibox />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:multibox name="per" property="city" value="哈尔滨"/>哈尔滨
<html:multibox name="per" property="city" value="大庆"/>大庆
<html:multibox name="per" property="city" value="北京"/>北京
注意:<html:checkbox />无法设置默认值,可以通过<html:multibox />代替.
7、<html:textarea />
<%
com.Person p = new com.Person();
pageContext.setAttribute("per",p);
%>
<html:textarea name="per" property="name"></html:textarea>
8、<html:form />
注意:
<html:form />必须和一个具体的ActionForm绑定.它是如何找到需要绑定的那个ActionForm呢?
答案:Action------>ActionForm
9、<html:submit />和<html:reset />
对应HTML中的 submit 和 reset