一、严格按照xml文件的格式书写,防止struts标签影响到xml的格式:
<?xml version="1.0" encoding="UTF-8"?><%@ page language="java" contentType="text/xml; charset=UTF-8" pageEncoding="UTF-8"%><%@taglib uri="/struts-tags" prefix="s"%>
<videos><s:iterator value="#request.videos" id="video" ><video id="<s:property value="id"/>">
<name><s:property value="name"></s:property></name>
<time><s:property value="time"></s:property></time>
</video></s:iterator>
</videos>
注意:1.<?xml version="1.0" encoding="UTF-8"?>必须是文件的开头一句,前面不要有空格,是xml文件的规定。
2.注意文档的格式,<videos><s:iterator value="#request.videos" id="video" >这两段间不要换行,防止以后解析出现不必要的麻烦
二、下面是浏览器看到的效果:
This XML file does not appear to have any style information associated with it. The document tree is shown below.