Accessing Java EE Scope Objects"
From Documentation
Line 21: | Line 21: | ||
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html org.zkoss.zk.ui.Sessions] | [http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html org.zkoss.zk.ui.Sessions] | ||
− | == | + | ==Get Current Session == |
[http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html#getCurrent() Sessions.getCurrent()] | [http://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Sessions.html#getCurrent() Sessions.getCurrent()] | ||
− | Retrieves the current session. | + | Retrieves the current ZK-wrapped session. |
+ | |||
+ | == Get HttpSession == | ||
+ | <syntaxhighlight lang="java"> | ||
+ | HttpSession nativeSession = (HttpSession) Sessions.getCurrent().getNativeSession(); | ||
+ | </syntaxhighlight> | ||
{{ZKDevelopersReferencePageFooter}} | {{ZKDevelopersReferencePageFooter}} |
Latest revision as of 06:12, 1 February 2024
Executions
getCurrent
Retrieves the current execution which contains HTTP request/response.
get HttpServletRequest
HttpServletRequest req = (HttpServletRequest)Executions.getCurrent().getNativeRequest()
Sessions
Get Current Session
Retrieves the current ZK-wrapped session.
Get HttpSession
HttpSession nativeSession = (HttpSession) Sessions.getCurrent().getNativeSession();