WEB开发网
开发学院数据库Oracle Oracle Web应用开发之Apache架设与PL/SQL页面设计... 阅读

Oracle Web应用开发之Apache架设与PL/SQL页面设计

 2007-05-17 12:31:04 来源:WEB开发网   
核心提示: 使用Oracle命令程序$ORACLE_HOMEinloadpsp.exe将第3步编写的PSP页面(show.psp)载入数据库的cf/cf模式下,loadpsp.exe程序的所有选项格式如下:l:oracleora90inloadpsp.exeusage: loadpsp [-rep

使用Oracle命令程序$ORACLE_HOMEinloadpsp.exe将第3步编写的PSP页面(show.psp)载入数据库的cf/cf模式下。loadpsp.exe程序的所有选项格式如下:

l:oracleora90inloadpsp.exe
usage: loadpsp [-replace] -user <logon> [<page1><page2> ...]
    where <logon> ::= <username>/<password>[@<connect_string>]

本例中使用如下命令:

l:oracleora90inloadpsp -replace -user cf/cf show.psp
"show.psp":procedure "show" created.

5.载入show.psp页面后,在数据库的cf/cf模式下生成存储过程show(该过程名由网页show.psp中的<%@ plsql procedure="show" %>程序决定),过程中已经加入HTP进程包来调用参数。

PROCEDURE show (
id IN NUMBER default 1001) AS
psp_id    student.id%TYPE:=id;
psp_name   student.name%TYPE;
psp_dob    student.dob%TYPE;
psp_gender  student.gender%TYPE;
psp_classyr  student.classyr%TYPE;
psp_major   student.major%TYPE;
psp_email   student.email%TYPE;
psp_photo   student.photo%TYPE;
BEGIN NULL;
htp.prn('
');
htp.prn('
');
htp.prn('
');
htp.prn('
');
htp.prn('
');
htp.prn('
');
htp.prn('
');
htp.prn('
');
htp.prn('
');
htp.prn('
');
htp.prn('
');
show_student
(  p_id     => psp_id
,  p_name    => psp_name
,  p_dob    => psp_dob
,  p_gender   => psp_gender
,  p_classyr  => psp_classyr
,  p_major   => psp_major
,  p_email   => psp_email
,  p_photo   => psp_photo
);
htp.prn('
<html>
<head>
<title>学生信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#999900" text="#FFFFFF" link="#3366FF">
<table width="80%" border="0" cellspacing="2" cellpadding="2" align="center"
height="400">
 <tr>
  <td colspan="3" height="72">
   <div align="center"><font size="+3"><b>学生信息</b></font></div>
  </td>
 </tr>
 <tr>
  <td width="40%" height="195" rowspan="8"><img src="admin_/images/');
htp.prn(psp_photo);
htp.prn('" width="172" height="191" align="middle"></td>
  <td colspan="2" height="30">编号为');
htp.prn(psp_id);
htp.prn('的学生的资料如下:</td>
 </tr>
 <tr>
  <td colspan="2" height="30">编号:');
htp.prn(psp_id);
htp.prn('</td>
 </tr>
 <tr>
  <td colspan="2" height="30">姓名:');
htp.prn(psp_name);
htp.prn('</td>
 </tr>
 <tr>
  <td colspan="2" height="30">出生日期:');
htp.prn(psp_dob);
htp.prn('</td>
 </tr>
 <tr>
  <td colspan="2" height="30">性别:');
htp.prn(psp_gender);
htp.prn('</td>
 </tr>
 <tr>
  <td colspan="2" height="30">年级:');
htp.prn(psp_classyr);
htp.prn('</td>
 </tr>
 <tr>
  <td colspan="2" height="30">主修课程:');
htp.prn(psp_major);
htp.prn('</td>
 </tr>
 <tr>
  <td colspan="2" height="30">电子邮件:');
htp.prn(psp_email);
htp.prn('</td>
 </tr>
 <tr>
  <td width="40%" height="74">
   <div align="center"></div>
  </td>
  <td width="46%" height="74">
   <div align="center"><a href="show?id=');
htp.prn(psp_id-1);
htp.prn('">上一页</a>
  <a href="show?id=');
htp.prn(psp_id+1);
htp.prn('">下一页</a></div>
  </td>
  <td height="74" width="14%">
   <div align="center"></div>
  </td>
 </tr>
</table>
</body>
</html>
');
END;

6.浏览网址:http://localhost/pls/simpledad/show,即可看到如图1所示的页面,可点击"上一页"或"下一页"浏览相临记录。

上一页  2 3 4 5 6 7 

Tags:Oracle Web 应用开发

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接