4 Replies Latest reply: Jul 25, 2012 12:48 PM by 91527 RSS

    How can I pass paramters to next page with session protection on?

    lxiscas
      Hi, guys:

      I encounter a problem of session protection problem. In a report page I set up a column of "map" link, so I can pass several parameters extracted from the same row to the new page where I can show map. I was using javascript popup2, and it worked well.
      javascript:popUp2('f?p=&APP_ID.:3006:&SESSION.::&DEBUG.::P3006_H_OFFENDER_NAME,P3006_H_OFFENDER_ID,P3006_H_ADDRESS_LATITUDE,P3006_H_ADDRESS_LONGITUDE,P3006_H_PHYSICAL_LATITUDE,P3006_H_PHYSICAL_LONGITUDE,P3006_H_ADDRESS,P3006_H_PHYSICAL_ADDRESS:#Offender Name#,#Offender ID#,#Address Latitude#,#Address Longitude#,#Physical Latitude#,#Physical Longitude#,#Address#,#Physical Address#','650','450');
      However, I am required to set all of pages, items with session protection now. after that I got problem as:

      Attempt to save item P3006_H_OFFENDER_NAME in session state during show processing, item has Internal Only protection.
      Contact your application administrator.

      So I changed it as redirect a page in application, and try to pass less parameters and query other parameters, but I got the similar problem:


      Attempt to save item P3006_H_OFFENDER_ID in session state during show processing, item has Internal Only protection.
      Contact your application administrator.


      I notice most of solutions would be turning the session protection as unrestricted for these items, but I am not allowed to do this. Is there any way that I can pass parameters from a row in a report while session protection is on?


      Thanks a lot!

      Sam
        • 1. Re: How can I pass paramters to next page with session protection on?
          WannaRock
          Hi Sam.
          You'll have to build the full link in your javascript function into a string with all parameters done. Then pass the value via AJAX to an OnDemand Application process that you can then call in your javascript. Then use the built in apex function apex_util.prepare_url(p_url => <your_url_string_var>,p_checksum_type => <your_ssp_type - for example 'SESSION'>); to htp.p your url.
          • 2. Re: How can I pass paramters to next page with session protection on?
            lxiscas
            WannaRock:

            Thanks for your help! Is there any thread with detail about it? I remember I read one before but I realy could not find it now on OTN. I found a lot of session protection thread but no detail about this yet.

            Thanks.

            Sam
            • 3. Re: How can I pass paramters to next page with session protection on?
              WannaRock
              I can quickly show you what I've done to solve for this:

              First, create a PL/SQL Anonymous block, application level process of type "On Demand"  Here is an example of what I'm using - I named the process is SIMPLE_SSP (name is important later)

              declare
              l_url varchar2(1000);
              s_url varchar2(2000);
              begin

              l_url := wwv_flow.g_x01; -- the apex name is g_x01 - note the key in the key value we pass later in javascript

              s_url := apex_util.prepare_url(p_url => l_url,p_checksum_type => 'SESSION'); -- and here's where we get checksum

              htp.p(s_url); -- and here's where we return it

              end;

              Next, I create a javascript function that can be called in the link

              function redir_ssp(p1,p2,p3) {
              var param1 = p1;
              var param2 = p2;
              var param3 = p3;
              // notice when creating our Ajax object we reference the Application process by name
              var ajaxReq = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=SIMPLE_SSP', 0);
              var sURL = 'f?p=&APP_ID.:4:&SESSION.::::P4_PARAM1,P4_PARAM2,P4_PARAM3:'+param1+','+param2+','+param3;

              // notice the 'x01' literal mirrors the built in apex var we used above. x01, x02, x03 ... etc match their counterparts.
              // you can use many parameters as long as you deal with them in the proc the same way
              ajaxReq.addParam('x01',sURL);
              var retURL = ajaxReq.get(); // and the htp.p is passed into the ajax get which is then returned in the retURL
              //alert(retURL); // for debug
              window.location.href = retURL; //this is the redirect.
              }



              Finally in the link

              &lt;a href="#" onclick="Javascript:redir_ssp(p1,p2,p3)"&gt;link text&lt;/a&gt;

              This can be easily altered to use in a pop up.
              • 4. Re: How can I pass paramters to next page with session protection on?
                91527
                Sam,

                The easiest way I've found is just to create a hidden item containing the PREPARE_URL, and then reference that item in your javascript. The example below is calling a page in another app, but it should work calling an another page in the same app:

                -------------------------------

                EXAMPLE:

                Because we are generally using session level checksums on URLs, the URLs must be prepared with a checksum for the current session.

                Say we are dealing with page 2. Thus page 2 has a hidden item (e.g., P2_PREPARED_URL_WITH_CKSUM_1) to hold the preparation in the "Source value or expression, for example:

                APEX_UTIL.PREPARE_URL('f?p=9002:3:&SESSION.::NO::G_CALLING_APP_ID,G_CALLING_APP_NAME,G_CALLING_APP_PAGE_ID:&APP_ID.,&G_APP_NAME.,&APP_PAGE_ID.','SESSION');

                The hidden item is then used within the "URL Target" of a button to open the corresponding page in the other application:

                javascript:popUp2('&P2_PREPARED_URL_WITH_CKSUM_1.',1200,1000)

                -------------------------

                Notice in the above example, I've hardcoded the app id 9002. You would probably want to use &APP_ID. bind variable syntax.

                See the long thread: https://forums.oracle.com/forums/thread.jspa?messageID=10394152. It points out a way (for now) even to call a page in an app in another workspace, but that capability that is apparently a bug and is to be fixed.

                Christian Neumueller was of great help.

                Chris