Java

本类阅读TOP10

·使用MyEclipse开发Struts框架的Hello World!(录像1)
·hibernate配置笔记
·AOP编程入门--Java篇
·linux下Tomcat 5.0.20 与 Apache 2 安装/集成/配置
·在win2003下整合了整合Tomcat5.5+ apache_2.0.53+ mod_jk_2.0.47.dll
·构建Linux下IDE环境--Eclipse篇
·Jsp 连接 mySQL、Oracle 数据库备忘(Windows平台)
·ASP、JSP、PHP 三种技术比较
·Tomcat5.5.9的安装配置
·AWT GUI 设计笔记(二)

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
J2EE学习笔记(6) Struts HTML Tags

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

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




相关文章

相关软件