开发者

Sending & in query String

From first.jsp I am sending some parameters to result.jsp as -

<a href="result.jsp?itemId=${itemId}&itemName=${item.itemName}&itemCode=${item.itemCode}')">Show Items</a>

Here ${item.itemName} can have values like "food & stationary". When item name contains an "&", I am not able to get whole value on result page, its printing only "food". Is there any way (in JSTL or any) so that I can encode "&". I know if I would convert "&" to "%26" then this would cor开发者_StackOverflow中文版rect.


Use JSTL's c:url and c:param for that. Basic example:

<a href="<c:url value="result.jsp">
    <c:param name="itemId" value="${itemId}" />
    <c:param name="itemName" value="${item.itemName}" />
    <c:param name="itemCode" value="${item.itemCode}" />
</c:url>">Show Items</a>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜