struts中常用的html标签

常用的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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值