打开会话状态保护时,如何在 Oracle APEX 中的树上创建手动链接?

发布于 2024-08-15 03:02:09 字数 1583 浏览 2 评论 0原文

朋友们,

我在 APEX 中面临着另一个挑战,我希望你们能提供帮助。

我使用 John & 中描述的方法创建了一棵树。 Scott 的精彩著作“Pro Application Express”,其中页面链接存储在表格中。下面是一个示例:

go to a page passing some parameters

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

当页面运行时,它会按预期工作。如果需要,我可以展开树并导航到传递参数的页面。

然而,当我打开会话状态保护时,这些“手工制作”的链接停止工作。这是我所期望的,因为该链接不包含校验和。

经过一番调查后,我发现我必须使用 APEX_UTIL.PREPARE_URL 来生成带有校验和的 URL。不幸的是,这就是我遇到问题的地方。我似乎无法将参数值传递到调用页面。

原始的树查询是:

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

然后我将其更改为使用 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,
...

这有效,页面被调用,我可以看到传递的参数的值。但我不能使用这个方法,因为它仅限于一页!

最后,我尝试将页码、参数和参数值存储在树所基于的表的不同列中,然后将它们放在一起:

...
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.

现在调用页面,但参数值已变成文字。因此,在我期待标识符的地方,我会看到 &P2_IDENTIFIER 和姓氏。

我做错了什么?如何使用 apex_util_prepare_url 将值传递到我的调用页面?

如果需要的话,我的环境详细信息是:Apex 3.2.1、Oracle Application Server 10.1.2.3。 Oracle 数据库 10.2.0.3

预先感谢您提供的任何帮助。

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.

However 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野の 2024-08-22 03:02:09

我认为您需要使用 v() 函数来解析这些变量:

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

顺便说一句,您可能需要小心 P2_FAMILY_NAME 因为它在 url 中使用;听起来像是一个包含用户输入数据的纯文本字段?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文