Reputation: 373
Based on the documentation and examples I have come across, it seems that the way to set/pass session state between pages is via the URL. It got me thinking, is it ok to reference page items from a different page directly? Or are there downsides in doing this that someone new to APEX (like me) may not be aware of initially.
For example:
PAGE 1
and PAGE 2
PAGE 1
sets P1_SOME_VALUE = 'GREEN'
(P1_SOME_VALUE
now in session state)PAGE 2
needs access to P1_SOME_VALUE
's valueAre there any reasons to not set up a BEFORE HEADER
Computation on PAGE 2
that sets P2_SOME_VALUE = :P1_SOME_VALUE
? (Assuming that P1_SOME_VALUE
is a given to always be available in the session for PAGE 2
)
If going from PAGE 1
to PAGE 2
is done using a hyperlink, then I understand it is easier to set the session state using the REDIRECT URL attribute method that I have seen. I have come across a situation in my app where a URL is generated dynamically after a chain of dynamic actions and using the BEFORE HEADER
Computation seems like the cleaner/simpler solution for my given situation. Just want to make sure I am not overlooking anything.
Upvotes: 1
Views: 1026
Reputation: 18665
The behaviour you describe, using a pl/sql process which references a page item from another page will work fine, but there are some things to take into account. Not sure if this list is exhaustive, others might comment:
P1_SOME_VALUE
is referenced on page 2. Or that other developer who works on it will hate you forever ;)P1_SOME_VALUE
will be cleared because that item is defined on page 1. Debugging this issue will be a challenge.P1_SOME_VALUE
or set the value of P1_SOME_VALUE
using javascript on page 2. This doesn't matter in your use case.An alternative to referencing page items in another page than the page they belong to is storing the data in a collection - that will exist for the duration of the session.
Upvotes: 2