Saturday, November 17, 2007

Passing Session Variables in a URL

When attempting to reference another page in your application with a URL link, it is important to know how to use APEX formatting. Here is an example:

http://apex.oracle.com/pls/apex/f?p=4350:1:220883407765693447

We will look at this starting with the pls and apex words. Basically, these two terms reference the apex application server, and are fairly common syntax for links.

f?p=4350:1:220883407765693447

The number 4350 represents the application id number, the number 1 represents the page number that will be referenced. The long number at the end of the link is the session id number. So, overall, a link will follow the following format:

http://apex.oracle.com/pls/apex/f?p=App:Page:Session

Other terms can be added in on the end, but I will not go into those at this point in time.

Now, if you want to develop dynamic links, the issue of setting the application,session id becomes an issue. Here is a little syntax to deal with that:

APP_SESSION.

Enter this term in place of the session ID number to take care of the dynamic data situation. The period at the end of the term is important, the link will not work without it.

If you want to make the application number dynamic, use the terminology:

APP_ID.

Again, the period needs to be at the end of the statement. So, overall, to make a totally dynamic url request, the following would be the pattern:

http://www.apex.com/pls/apex/f?p=&APP_ID.:1:&APP_SESSION.

&APP_ID will be the dynamic application id, &app_session will be the dynamic session variable.
Here is a helpful link.


Hope this helps.

Cheers
Jason

No comments: