在jsp中使用jstl标签时出现的问题:

songjun37 songjun37 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我的xml文件是:
==============
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user id ="1">
<sex>男</sex>
<name>张三</name>
<age>xx</age>
<add>四川江油</add>
</user>

<user id = "2">
<sex>男</sex>
<name>李四</name>
<age>xx</age>
<add>四川广安</add>
</user>

<user id = "3">
<sex>男</sex>
<name>王五</name>
<age>xx</age>
<add>江西永新</add>
</user>

<user id = "4">
<sex>男</sex>
<name>刘六</name>
<age>xx</age>
<add>湖南永州</add>
</user>
</users>
===========================================
在jsp页面中使用是:
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml"%>
<html>
<head>

<title> <jstl > study</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>

<body>
输出XML文件标签 x:out 用法举例:<hr>
<x:parse var="users" scope="application">
<c:import url="users.xml" charEncoding="GBK" />
</x:parse>
学生:(id=001):</br>
<x:out select="$users/user@[id=4]" /></br>
</body>
</html>
==========================
问题:通过以上使用时浏览器会报一个错误是:
org.xml.sax.SAXParseException: The element type "sex" must be terminated by the matching end-tag "</sex>".
=================================
但是我检测了好几次有那个结束的</sex>啊
请问各位大虾们 ,问题是出自哪里呢?
...全文

相关推荐

评论 10
收藏 已收藏
分享
返回顶部
songjun37
Web 开发 81,108 成员 341,720 内容