开发者

How do I create a manual link on a tree in Oracle APEX when Session State Protection is turned on?

Friends,

I'm facing another challenge in APEX and I hope you can help.

I have created a tree using the method described in John & Scott's superb book, "Pro Application Express" whereby the page link is stored in a table. Below is an example:

go to a page passing some parameters

f?p=&APP_ID.:3:&SESSION.::::P3_IDENTIFIER,P3_FAMILY_NAME:&P2_IDENTIFIER.,&P2_FAMILY_NAME.

When the page is run this works as expected. I can expand the tree and navigate to the page passing parameters if required.

Ho开发者_如何学Pythonwever when I turned on session state protection these "hand crafted" links stopped working. Which I expected because the link contains no checksum.

After some investigation I see I have to use APEX_UTIL.PREPARE_URL to generate the URL with a checksum. Unfortunately this is where I run into problems. I can't seem to be able to pass the parameters values to the calling page.

The original tree query was:

select "IDENTIFIER" id,
"PARENT_IDENTIFIER" pid,
"TITLE" name,
"LINK" link,
null a1,
null a2
from <some table>

I then changed this to use APEX_UTIL.PREPARE_URL:

....
APEX_UTIL.PREPARE_URL('f?p='||:APP_ID||':3:'||:APP_SESSION||'::::P3_IDENTIFIER,P3_FAMILY_NAME:&P2_IDENTIFIER.,&P2_FAMILY_NAME.') link,
...

and this works, the page is called and I can see the values of the parameters passed. But I can't use this method as it is restricted to the one page!

Finally I tried storing the page number, parameters and parameter values in different columns of the table that the tree is based on and then bring them together:

...
APEX_UTIL.PREPARE_URL('f?p='||:APP_ID||':'||navigate_to_page||':'||:APP_SESSION||'::::'||parameters||':'||parameter_values) link,
...

Where: 

navigate to page has the value of: 3
parameters has the value of: P3_IDENTIFIER,P3_FAMILY_NAME
parameter_values has the values of: &P2_IDENTIFIER.,&P2_FAMILY_NAME.

This now calls the page, but the parameter values have become literals. so where I'm expecting an identifier I see &P2_IDENTIFIER and ditto for family name.

What am I doing wrong? How can I pass values to my called page using apex_util_prepare_url?

In case of need, my environment details are: Apex 3.2.1, Oracle Application Server 10.1.2.3. Oracle Database 10.2.0.3

Thanks in advance for any help you may be able to provide.


I think you'll need to resolve those variables, using the v() function:

APEX_UTIL.PREPARE_URL('f?p='||:APP_ID
||':'||navigate_to_page
||':'||:APP_SESSION
||'::::'||parameters
||':'||v('P2_IDENTIFIER')||','||v('P2_FAMILY_NAME')) link,

On a side note, you might need to be careful about P2_FAMILY_NAME since it's being used in the url; it sounds like a plain text field which contains user-entered data?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜