SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Jsp sessions

  1. #1
    SitePoint Zealot Biju's Avatar
    Join Date
    Sep 2004
    Location
    India
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jsp sessions

    <?php
    session_start();
    ob_start();

    if($_GET['sessionvar']!=''){
    $sessionvariable = $_GET['sessionvar'];
    $sessionvalue = $_GET['sessionvalue'];

    $_SESSION[$sessionvariable] = $sessionvalue;
    }else {
    $_SESSION[$sessionvariable] = '';
    }
    echo $_SESSION[$sessionvariable];
    ?>
    Can anyone show the jsp part of this php code.
    I suggest everyone to upgrade to Windows Vista.

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2007
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Biju View Post
    Can anyone show the jsp part of this php code.
    Bother to explain what this code does? i don't do php.

    Sessions are normally obtained from httpServletRequest.

    example-
    Code:
    HttpSession session = request.getSession();
    //do whatever with the session here...~
    Also look at the api for HttpSession

    hope that helps.

    regards,

    ajos777

  3. #3
    SitePoint Wizard rozner's Avatar
    Join Date
    Oct 2002
    Location
    Paris
    Posts
    1,058
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Biju View Post
    Can anyone show the jsp part of this php code.
    it would look something like this

    Code:
    // get session
    if (session == null) {
        session = request.getSession();
    }
    
    // get request param
    String requestParamValue = null;
    if (request.getParameter("paramName") != null ) {
        requestParamValue = request.getParameter("paramName");
        
        // store requestParam value to session
        session.setAttribute("paramName", requestParamValue);
    
        // echo
        out.print(requestParamValue);
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •