开发者

How do I send the jsessionid via POST using hidden inputs when cookies are disabled in JSP?

Is there any way to send JSESSIONID via hidden inputs? Something like

<input type="hidden" name="JSESSIONID" valu开发者_运维技巧e="<%= session.getId() %>"/>

I tried everything but nothing seems to be working.

It works if I directly access the other page with

www.example.com/app/q.jsp;jsessionid=CC7A1A07E117B66F4C5D8910F4F138F3


Don't put it in a hidden input, but add it as a query parameter to the "action" attribute of the form. Or, rather just use JSTL <c:url> on the action (as you should on all URLs).


Try appending the ;jsessionid bit to the url in your form action.

An even better way is to use the JSTL <c:url> tag whenever you print a url. This will automatically ensure the jsession id is added if cookies are disabled:

<form action="<c:url value="form.jsp" />">

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜