开发者

JSTL number handling

I set the session variable like below

getSession(true).setAttribute("entriesCount", "10");

then the call below returning nothing i开发者_C百科n jstl.

<c:out value="${#session.entriesCount}"/>


Try

<c:out value="${entriesCount}"/>

or

<c:out value="${sessionScope.entriesCount}"/>

This seems useful:

the expression ${name} refers to a scoped variable named name. That scoped variable can reside in page, request, session, or application scope. The expression language searches those scopes, in that order, for scoped variables.

and

The implicit objects listed above let you explicitly access variables stored in a specific scope; for example, if you know that the name scoped variable resides in session scope, the expression ${sessionScope.name} is equivalent to ${name}, but the latter unnecessarily searches the page and request scopes before finding the name scoped variable in session scope


Where did you read about #session and what's it? You should be fine just with <c:out value="${entriesCount}"/>.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜