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/>了事
