Session Scope Variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anna K.

    Session Scope Variables


    Hi Experts,

    I want to create an object within the session scope
    (one that will be unique to everyone who logs into the system),
    yet persist throughout the login session.

    Would the "document" object suffice?
    ... or do I need to go up to the next level in scope?


    AK
  • Ivo

    #2
    Re: Session Scope Variables

    "Anna K." wrote[color=blue]
    > I want to create an object within the session scope
    > (one that will be unique to everyone who logs into the system),
    > yet persist throughout the login session.
    >
    > Would the "document" object suffice?
    > ... or do I need to go up to the next level in scope?[/color]

    I 'm afraid that wouldn't help much. Javascript has no notion of sessions.
    It only knows the current page, it is born onload and dies onunload. You
    need some serverside technology like ASP or PHP to create sessions existing
    over multiple pages.
    HTH
    --
    Ivo


    Comment

    • Anna K.

      #3
      Re: Session Scope Variables

      On Tue, 16 Nov 2004 03:20:39 +0100, "Ivo" <no@thank.you > wrote:
      [color=blue]
      >"Anna K." wrote[color=green]
      >> I want to create an object within the session scope
      >> (one that will be unique to everyone who logs into the system),
      >> yet persist throughout the login session.
      >>
      >> Would the "document" object suffice?
      >> ... or do I need to go up to the next level in scope?[/color]
      >
      >I 'm afraid that wouldn't help much. Javascript has no notion of sessions.
      >It only knows the current page, it is born onload and dies onunload. You
      >need some serverside technology like ASP or PHP to create sessions existing
      >over multiple pages.
      >HTH[/color]

      Yes - this DOES help.

      Thank you very much.

      One question: What does the <server></server> tag pair do?


      AK

      Comment

      • Evertjan.

        #4
        Re: Session Scope Variables

        Ivo wrote on 16 nov 2004 in comp.lang.javas cript:
        [color=blue]
        > I 'm afraid that wouldn't help much. Javascript has no notion of
        > sessions. It only knows the current page, it is born onload and dies
        > onunload. You need some serverside technology like ASP or PHP to
        > create sessions existing over multiple pages.[/color]

        Incorrect,
        inasmuch as "javascript " would mean "clientside d script".

        ASP understands serversided(!) J(ava)script
        and can use javascript accessable session variables and databases.

        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress,
        but let us keep the discussions in the newsgroup)

        Comment

        • Grant Wagner

          #5
          Re: Session Scope Variables

          "Anna K." wrote:
          [color=blue]
          > On Tue, 16 Nov 2004 03:20:39 +0100, "Ivo" <no@thank.you > wrote:
          >[color=green]
          > >"Anna K." wrote[color=darkred]
          > >> I want to create an object within the session scope
          > >> (one that will be unique to everyone who logs into the system),
          > >> yet persist throughout the login session.
          > >>
          > >> Would the "document" object suffice?
          > >> ... or do I need to go up to the next level in scope?[/color]
          > >
          > >I 'm afraid that wouldn't help much. Javascript has no notion of sessions.
          > >It only knows the current page, it is born onload and dies onunload. You
          > >need some serverside technology like ASP or PHP to create sessions existing
          > >over multiple pages.
          > >HTH[/color]
          >
          > Yes - this DOES help.
          >
          > Thank you very much.
          >
          > One question: What does the <server></server> tag pair do?[/color]

          On Netscape (Sun ONE) Enterprise servers, the <server></server> tag pair
          delimits server-side JavaScript code (or at least used to, I am not familiar
          with their latest server offerings). Other application servers may use them as
          well. Personally I'd recommend using a more robust server-side technology (such
          as JSP or PHP), even when server-side JavaScript is provided.

          <url: http://docs.sun.com/source/816-5930-10/intro.htm#13144 />

          --
          Grant Wagner <gwagner@agrico reunited.com>
          comp.lang.javas cript FAQ - http://jibbering.com/faq

          Comment

          • Anna K.

            #6
            Re: Session Scope Variables

            On Tue, 16 Nov 2004 14:39:00 GMT, Grant Wagner <gwagner@agrico reunited.com> wrote:
            [color=blue]
            >"Anna K." wrote:
            >[color=green]
            >> On Tue, 16 Nov 2004 03:20:39 +0100, "Ivo" <no@thank.you > wrote:
            >>[color=darkred]
            >> >"Anna K." wrote
            >> >> I want to create an object within the session scope
            >> >> (one that will be unique to everyone who logs into the system),
            >> >> yet persist throughout the login session.
            >> >>
            >> >> Would the "document" object suffice?
            >> >> ... or do I need to go up to the next level in scope?
            >> >
            >> >I 'm afraid that wouldn't help much. Javascript has no notion of sessions.
            >> >It only knows the current page, it is born onload and dies onunload. You
            >> >need some serverside technology like ASP or PHP to create sessions existing
            >> >over multiple pages.
            >> >HTH[/color]
            >>
            >> Yes - this DOES help.
            >>
            >> Thank you very much.
            >>
            >> One question: What does the <server></server> tag pair do?[/color]
            >
            >On Netscape (Sun ONE) Enterprise servers, the <server></server> tag pair
            >delimits server-side JavaScript code (or at least used to, I am not familiar
            >with their latest server offerings). Other application servers may use them as
            >well. Personally I'd recommend using a more robust server-side technology (such
            >as JSP or PHP), even when server-side JavaScript is provided.[/color]

            This looks like good advice - thanks.

            [color=blue]
            ><url: http://docs.sun.com/source/816-5930-10/intro.htm#13144 />[/color]

            I have this site bookmarked - thanks again.

            AK

            Comment

            • Anna K.

              #7
              Re: Session Scope Variables

              On 16 Nov 2004 10:51:17 GMT, "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote:
              [color=blue]
              >Ivo wrote on 16 nov 2004 in comp.lang.javas cript:
              >[color=green]
              >> I 'm afraid that wouldn't help much. Javascript has no notion of
              >> sessions. It only knows the current page, it is born onload and dies
              >> onunload. You need some serverside technology like ASP or PHP to
              >> create sessions existing over multiple pages.[/color]
              >
              >Incorrect,
              >inasmuch as "javascript " would mean "clientside d script".
              >
              >ASP understands serversided(!) J(ava)script
              >and can use javascript accessable session variables and databases.[/color]

              So I would use the <server> tags with ASP (as Grant Wagner pointed out).

              AK

              Comment

              • Evertjan.

                #8
                Re: Session Scope Variables

                Anna K. wrote on 17 nov 2004 in comp.lang.javas cript:[color=blue]
                > So I would use the <server> tags with ASP (as Grant Wagner pointed
                > out).[/color]

                No, not with ASP [on a Server running Windows]

                Use:

                <script language=jscrip t runat=server>
                for (var i=0;i<10;i++) response.write( i+'<br>');
                session("test") = ++i
                </script>

                Or:

                <%@ Language=JScrip t %>

                <%
                for (var i=0;i<10;i++) response.write( i+'<br>');
                session("test") = ++i
                %>

                Warning:
                mixing(!) jscript and vbscript in ASP has it's peculiar priorities

                For jscript and vbscript ASP questions I suggest the NG:
                microsoft.publi c.inetserver.as p.general

                --
                Evertjan.
                The Netherlands.
                (Please change the x'es to dots in my emailaddress,
                but let us keep the discussions in the newsgroup)

                Comment

                Working...