Mark
asked on
can I reference session variables in jsp subroutine?
I have a function:
<%!
static void myFunction(String something)
{
String sessionVar = (String) session.getAttribute("sess ionVar");
}
%>
This gives me the error:
An error occurred at line: 437 in the jsp file: /printAPchecks.jsp
session cannot be resolved
How do I reference session variables in subroutines?
<%!
static void myFunction(String something)
{
String sessionVar = (String) session.getAttribute("sess
}
%>
This gives me the error:
An error occurred at line: 437 in the jsp file: /printAPchecks.jsp
session cannot be resolved
How do I reference session variables in subroutines?
ASKER
Looked promising, but I get:
An error occurred at line: 437 in the jsp file: /printAPchecks.jsp
session cannot be resolved
I typed it as you showed:
<%!
HttpSession sessionObject = session;
:
%>
do I need to import something?
An error occurred at line: 437 in the jsp file: /printAPchecks.jsp
session cannot be resolved
I typed it as you showed:
<%!
HttpSession sessionObject = session;
:
%>
do I need to import something?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@mccarl, the problem with your idea is that all concurrent users will have to share the same sessionObject.
Ah yes, my bad, forget what I have said and go with rrz@871311's approach! :)
ASKER
I'm going to experiment with this a bit more and get back with results.
ASKER
You know, I'm not going to get around to playing with this any time soon. I solved the problem by passing the parameters I need to the subroutine from the caller and I'm just not getting around to playing with the subroutine/session-variabl e notion. I'm going to close this out and thank everyone for participating!
Open in new window