欢迎光临
我们一直在努力

J2EE学习笔记(6) Struts HTML Tags-JSP教程,J2EE/EJB/服务器

建站超值云服务器,限时71元/月

html tags

一些公用的tag attributes在htmltaglib里的含义前后一致,它们是

name: actionform bean的实例名,如果name不存在,<html:form>所关联的formbean会生效。

property: property既决定了生成的html的fieldname,也决定了该field的值 via formbean.getthisproperty

value: value决定了生成html的field的value,注意它不是bean的propertyname

<html:html>和普通<html>不同的是,1)自动加上hidden token 2)自动加上context_root

剩下的以后慢慢加。。。

消息(错误)显示

actionmessages messages = new actionmessages();

messages.add(actionmessages.global_message, new actionmessage("userform.insert", info.getusername());

messages.add("activationdate", new actionmessage("userform.active", info.getdatelength());

如下可以显示所有消息,并用<li>将它们放入一个list,再加上可定制的header/footer

<html:messages id="message" header="errors.header" footer="errors.footer">

<li><bean:write name="message"/></li>

</html:messages>

如下可以指定只显示某种message

<html:messages id="message" property="<%= org.apache.struts.action.actionmessages.global_message %>">

<li><bean:write name="message"/></li>

</html:messages>

把messages换成errors就是错误显示,为了简便,经常一个<html:errors/>了事

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » J2EE学习笔记(6) Struts HTML Tags-JSP教程,J2EE/EJB/服务器
分享到: 更多 (0)

相关推荐

  • 暂无文章