从jsp读取xml [英] read xml from jsp
本文介绍了从jsp读取xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
让我说我有一个像这样的xml文件"path.xml":
lets say i have an xml file "path.xml" that goes like this:
<paths>
<path id="first">
<url>http://blablabla</url>
</path>
<path id="second">
<url>http://blablabla</url>
</path>
</paths>
我有一个jsp文件,我想从中读取基于id的url. 例如: 我想在jsp文件中编写一些Java代码,例如:字符串path =从xml文件中获取"url",其中path id ="second".
i have a jsp file from which i want to read url based on the id. for example: i want to write in the jsp file some java code like:String path = get from xml file the "url", where path id = "second".
这在jsp中如何完成?我对使用jsp进行Dom解析不是很有经验
how is this done in jsp? i am not very experienced with Dom parsing in jsp
非常感谢:)
推荐答案
You could use XML Tag Library :
<x:parse doc="path.xml" var="doc" scope="application"/>
<x:out select="$doc/paths/path[id='second']/url"/>
这篇关于从jsp读取xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文