Skip to Content
author's profile photo Former Member
Former Member

retrieve session variable

<b>Hi</b>

I create a session variable like this:

request.getComponentSession().putValue("myText", "A short note in the session");

And then tries to retrieve the value in another component like this:

sTest = request.getComponentSession().getValue("myText").toString;

sTest is declared as a string.

But I get an error. How do I retrieve the value?

Brgds// -Fred

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 19, 2004 at 03:54 AM

    Hi Fred,

    Setting and retrieving the session values works for me, in the way which you have described.

    Probably the brackets after toString (toString()), might be the problem.

    Vivek

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2004 at 04:46 PM

    Hi,

    you wrote: retrieve the value in another component.

    the session scope is the component. When you put a value to the session of component A, you cannot retrieve the value in the session of component B.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.