Passing control from one JSP to Another


Web tier: servlets, JSP, Web frameworks: Passing control from one JSP to Another

  1. Passing control from one JSP to Another (2 messages)

    I have a generalised program for authorization. I have a number of number of activities which needs to be authorised by users with Admin rights.
    I popup this Authorization JSP in a new popup window whenever it requires authorization using javascripts. After the authorization is done I need to give the success or failure result to the calling JSP. Can anybody tell me how do I go about doing this?

    Thanks in advance,
  2. Passing control from one JSP to Another[ Go to top ]

    Hi Anish,

    I was glad to see your question, because I am trying to find the answer to something similar. I have a pop-up window that is generated using a JavaScript from within a JSP page. My problem, is I am unable to get the parameters passed into this pop-up window from the requesting HTML page (generated using JSP). Hope you get an answer to your question and be able to answer mine based on that.


  3. Passing control from one JSP to Another[ Go to top ]

    I think I have an answer to your problem.
    While popping up the new window I assume that you are using with the first parameter being the name of the JSP you are trying to open. With the name of the JSP, in the same parameter pass the query string.
    For eg. in the javascript function you could have

    var queryString = "/validate.jsp?userid=" + document.login.userid.value + "&password=" + document.login.pwd.value;,"Authorise");

    // Here userid and pwd are textfields and password fields
    // respectively

    This would open up a new window.

    In the validate.jsp, using the request object you can get the values passed. You could do it like --

    String UserID = request.getParameter("userid");
    String Password = request.getParameter("password");

    It works for me. Try it.