#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    21
    Rep Power
    0

    Question using javascript variables in jsp


    Hi

    I want to set the 3 variables below (acceptrefuse, fivenine, commitnot) to session variables in jsp. How do I do that? This is my code:

    <script language="javascript">

    var acceptrefuse = QueryString["R1"]
    var fivenine = QueryString["R2"]
    var commitnot = QueryString["R3"]

    if(acceptrefuse == "Refuse") {
    location.href='endofprocess.jsp?acceptrefuse=Refuse'; }
    else if(acceptrefuse == "Accept" && fivenine == "Five" && commitnot == "NotCommit") {
    location.href='joindexia.jsp?acceptrefuse=Accept&fivenine=Five&commitnot=Not';
    }
    else if(acceptrefuse == "Accept" && fivenine == "Nine" && commitnot == "NotCommit") {
    location.href='joindexia.jsp?acceptrefuse=Accept&fivenine=Nine&commitnot=Not';
    }
    else if(acceptrefuse == "Accept" && fivenine == "Five" && commitnot == "Commit") {
    location.href='joindexia.jsp?acceptrefuse=Accept&fivenine=Five&commitnot=Commit';
    }
    else if(acceptrefuse == "Accept" && fivenine == "Nine" && commitnot == "Commit") {
    location.href='joindexia.jsp?acceptrefuse=Accept&fivenine=Nine&commitnot=Commit';
    }
    </script>
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    5
    Rep Power
    0
    A form is being submitted to this page? I don't see why you would have any of this in javascript. You can more easily process the query, set the session variables and do the redirect in a jsp or servlet. It looks like it would be even better process the request in a page with no html and forward to the right display jsp.

IMN logo majestic logo threadwatch logo seochat tools logo