顯示具有 STRUTS 標籤的文章。 顯示所有文章
顯示具有 STRUTS 標籤的文章。 顯示所有文章

2009年12月11日 星期五

html:errors

在Action或Form里生成errors:

在Action中使用:



若用则显示出所有的错误

文章出處:

http://www.cjsdn.net/post/view?bid=20&id=138667&sty=1&tpg=11&age=0

struts標籤範例-logicnotempty/

Html代码

1.
2. 内容
3.


Java代码

1. if(idbmqx!=null)
2. {
3. 内容
4. }

文章出處:

http://heisetoufa.javaeye.com/blog/227347

struts標籤使用舉例-logic

1. logic:empty
该标签是用来判断是否为空的。如果为空,该标签体中嵌入的内容就会被处理。该标签用于以下情况:

1)当Java对象为null时;
2)当String对象为”"时;
3)当java.util.Collection对象中的isEmpty()返回true时;
4)当java.util.Map对象中的isEmpty()返回true时。
eg.



该句等同于:
if (userList.isEmpty()) {

}

文章出處:

http://qsrock.javaeye.com/blog/145529

structs-config-xml-version

配置structs-config.xml 時, 一旦加上了 元素, 便會出錯

訊息類似:

Parse Error at line 15 column 68: Element type ”plug-in” must be declared.

….

org.xml.sax.SAXParseException: The content of element type ”struts-config” must match ”(data-soures?,form-beans?,global-forwards?,action-mappings?)”.

….

其實這主要是版本的問題.


正是你声明了才会报错,首先说这个错误的问题,因为你的配置文件头用的

所 以使用的是struts1.0的配置文件格式,你可以从http://jakarta.apache.org/struts/dtds/struts- config_1_0.dtd下载这个DTD看看里面不包含messeage-resources和plug-in的元素定义,另外从错误提示中也可以看 出来
org.xml.sax.SAXParseException: The content of element type ”struts-config” must match ”(data-soures?,form-beans?,global-forwards?,action-mappings?)”.

解决办法一是去掉那两个元素,二是文档定义用比struts1.0更高版本的,例如

这个是struts1.2的,但也要保证你用的struts包也是1.2的

資料來源: http://www.javaresearch.org/forum/thread.jsp?column=20&thread=36528