如何比较 xml 元素与 jsp 中的变量
How to compare xml-element with variable in jsp
我正在尝试将 xml 元素与我从 post 请求中获得的变量进行比较。
因此我的第一个 .jsp 使用
<form action="test.jsp" method="POST">
<input type="text" name="test" ><input type="submit">
在 test.jsp 中,我尝试与
进行比较
<c:import var="xml" url="http://localhost:8080/myxml.xml" />
<x:parse xml="${xml}" var="output"/>
<x:forEach var="adress" select="$output/order/adress">
<x:if select="city = param.test">
<li>Test</li>
</x:if>
</x:forEach>
但它总是错误的。
当我使用字符串而不是 param.test
时,一切正常。
如何使用我的输入进行比较?
最后我可以用下面的代码解决我的问题:
<x:forEach select="$output/order/adress" var="item">
<x:set var="city" select="string($item/city)"/>
<c:if test="${city == param.test)}">
<li>works</li>
</c:if>
</x:forEach>
我正在尝试将 xml 元素与我从 post 请求中获得的变量进行比较。 因此我的第一个 .jsp 使用
<form action="test.jsp" method="POST">
<input type="text" name="test" ><input type="submit">
在 test.jsp 中,我尝试与
进行比较<c:import var="xml" url="http://localhost:8080/myxml.xml" />
<x:parse xml="${xml}" var="output"/>
<x:forEach var="adress" select="$output/order/adress">
<x:if select="city = param.test">
<li>Test</li>
</x:if>
</x:forEach>
但它总是错误的。
当我使用字符串而不是 param.test
时,一切正常。
如何使用我的输入进行比较?
最后我可以用下面的代码解决我的问题:
<x:forEach select="$output/order/adress" var="item">
<x:set var="city" select="string($item/city)"/>
<c:if test="${city == param.test)}">
<li>works</li>
</c:if>
</x:forEach>