如何在JSP中获取XML的属性posID以设置为HTML选项标记的值,因为没有用于访问属性的标记?
XML:
<vocabul>
<PosWord posID="1">ABC</PosWord>
</vocabul>
JSP:
<x:parse xml="${sessionScope.places}" var="doc"/>
<select name="ChooseVoc">
<x:forEach select="$doc/vocabul/PosWord" var="item">
<option value="<x:out select="posID" />"/>
<x:out select="Pos_Txt" />
</option>
</x:forEach>
</select>
答案 0 :(得分:0)
<x:parse xml="${sessionScope.places}" var="doc"/>
<select name="ChooseVoc">
<x:forEach select="$doc/vocabul/PosWord" var="item">
<option value="<x:out select="$item/@posID" />"/>
<x:out select="$item" />
</option>
</x:forEach>
</select>
适合我