开发者

<c:if test="${!request.isRequestedSessionIdFromCookie()}"> must be used with a namespace?

I tried:

<c:if test="${!request.isRequestedSessionIdFromCookie()}">

in ony of my JSPs since c:url isn't encoding my url's for some reason. (working on that开发者_高级运维 one). So I wanted to try and check if cookies are enabled with this but I get the error:

The function isRequestedSessionIdFromCookie must be used with a prefix when a default namespace is not specified

Does anyone know what it means with that? I've frequently used EL with request and I've never gotten this error.


Unless you're on Servlet 3.0 / JSP 2.2, you cannot invoke methods on EL objects like that. You need to treat them the Javabean-way all the way. I.e. do not use get or is prefixes and also not method parens ().

<c:if test="${!request.requestedSessionIdFromCookie}">

(I assume that HttpServletRequest is been placed there, otherwise you've to get it by PageContext first)

<c:if test="${!pageContext.request.requestedSessionIdFromCookie}">

As to the concrete problem of the URL's not being encoded by c:out, that tag isn't responsible for that. Aren't you confusing it with c:url?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜