如何在 Oracle10gXE 上的 PL/SQL 中包含 .js 文件
再次。我正在制作 PL/SQL 生成的 HTML5 网页。它正在运行 Oracle 10g XE 服务器。好的,现在设置清楚了,我的问题是 - 我需要在页面中包含一个 Java 脚本文件。当然
HTP.P('<script type="text/javascript" src="js/ScriptFileName.js"></script>');
根本行不通。所以我创建了一个文件夹对象并授予 PUBLIC 读、写权限。然后更改字符串以匹配新创建的对象,而不是路径。还是不行。我知道,我可以写
HTP.P(<script type="text/javascript"> MY JAVA SCRIPT HERE</script>);
并且我已经用其他脚本这样做了(甚至不得不这样写CSS)。但这一次这是行不通的。原因是 - 我试图运行的 JavaScript 是标准化的(或者更确切地说是非标准化的),所以它全部写在一行中。而且还有很多。我尝试将其恢复正常,但多次失败。
于是,我上网寻找解决方案。找到了一个。看来这个包含不应该进入页面,而应该进入服务器配置。这是有道理的,因为 PL/SQL 是服务器端的。但是当我去寻找通常的 httpd.conf 时,在数据库目录中找不到它。所以我再次上网,结果 - 在任何 ORACLE 手册中都没有提到 10gXE 中的 HTTP 服务器配置在哪里。搜索了一些论坛 - 正好有 1 人询问 XE 中的 httpd.conf 在哪里,但没有得到答案。请帮忙。我很绝望。
PS我不使用APEX。我不明白那些胡言乱语。所以我在记事本中编写并在 SQL 行中运行脚本。
again. I'm making a PL/SQL generated HTML5 web page. It's running a Oracle 10g XE server. Okay, now when the setup is clear, my problem - I need to include a Java Script file in the page. Simply
HTP.P('<script type="text/javascript" src="js/ScriptFileName.js"></script>');
Doesn't work of course. So i created a folder object and granted read,write to PUBLIC. Then changed the string to match the newly created object, instead of path. Still doesn't work. I know, i can write
HTP.P(<script type="text/javascript"> MY JAVA SCRIPT HERE</script>);
And i've done so with other scripts(Even had to write CSS this way). But this time this will not work. Reason being - the JavaScript i'm trying to run was normalized(or rather unnormalized), so it's written all in one line. And there is a lot of it too. I tried to reverse it to normal, but faild many a time.
So, I went online and searched for a solution. Found one. It seem's that this include should go not to the page, but to server config. Makes sense, since PL/SQL is server sided. But when i went looking for the usual httpd.conf, it's nowhere to be found in Database directory.So i went online again, result - NOT A WORD OF WHERE THE HELL ARE HTTP SERVER CONFIGS IN 10gXE IN ANY ORACLE MANUALS. Searched some forums - exactly 1 person asked where httpd.conf in XE is, and didn't get an answer. Please, help. I'm desperate.
P.S. I don't use APEX. I don't get that mumbo-jumbo. So i write in Notepad and run the scripts in SQL line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,XE 有自己的内置 HTTP 服务器,称为“嵌入式 PL/SQL 网关”或 EPG。但你不必使用它。您可以将 Oracle HTTP Server 与 mod_plsql 插件结合使用。或者您可以使用 Apex 侦听器。
问题是“ScriptFileName.js”在什么服务器上?
它是数据库服务器上的平面文件吗?如果是这样,您将需要使用 Oracle HTTP Server(或 Apache 或类似服务器)来为其提供服务。数据库几乎不知道其服务器上的文件,并且 EPG 无法传送它们。 [至少不是在任何实际意义上,你可以用鸡内脏和 UTL_FILE 做奇怪的事情,但你不想去那里。]
它是存储在数据库中的文件吗?这听起来很奇怪,但这几乎就是所有 CSS、图像等通过 EPG 提供的方式。关于如何将文件导入和导出的最佳解释是 Dietmar
它是存储在单独机器上的文件吗?往往是最好的答案。 “src=”指令将由最终用户浏览器读取。这将执行 HTTP 获取 URL。它不必是与页面其余部分位于同一域/主机上的 URL。
Firstly, XE has its own built in HTTP server called the 'Embedded PL/SQL Gateway' or EPG. But you don't HAVE to use that. You can use an Oracle HTTP Server with the mod_plsql plugin. Or you can use the Apex listener.
The question is on what server is "ScriptFileName.js" ?
Is it a flat file on the database server ? If so, you'll need to use the Oracle HTTP Server (or Apache or similar) to serve it. The database is pretty much unaware of files on its server and the EPG can't deliver them. [At least not in any practical sense, you could do weird things with chicken entrails and UTL_FILE, but you don't want to go there.]
Is it a file stored in the database ? That sounds exotic, but it is pretty much how all the CSS, images etc are served up through the EPG. The best explanation on how to get files in and out of there is by Dietmar
Is it a file stored on a separate machine ? Often the best answer. The "src=" directive will be read by the end users browser. That will do an HTTP get to the URL. It doesn't have to be a URL on the same domain/host as the rest of the page.