Presentation is loading. Please wait.

Presentation is loading. Please wait.

PL/SQL Server Pages (Web Programming with PL/SQL)

Similar presentations


Presentation on theme: "PL/SQL Server Pages (Web Programming with PL/SQL)"— Presentation transcript:

1 PL/SQL Server Pages (Web Programming with PL/SQL)
Erdogan Dogdu Georgia State University Computer Science Department

2 Content Disadvantages of Web Toolkit PL/SQL Server Pages Syntax
Loading PSP Pages Example

3 Disadvantages of Web Toolkit
PL/SQL Web Toolkit (htp, htf) generates HTML code form PL/SQL programs. Generating nice web pages is difficult, you cannot author PL/SQL programs in Frontpage. Solution is PSP (next)

4 PL/SQL Server Pages (PSP)
Author web pages using script-friendly HTML authoring tools. Drop in PL/SQL code within HTML code using scripting tag <% %>. In short: Web Toolkit: generate HTML from PL/SQL PSP: embedded PL/SQL within HTML

5 Syntax of PL/SQL Server Pages
Same script tag syntax as in ASP and JSP: <% … %> PSP files should have .psp extension Can be as simple as an HTML page (no PL/SQL script) Specifying the scripting language

6 Syntax of PL/SQL Server Pages
Parameter passing Returned document type Such as text/xml, text/plain, image/jpeg Stored procedure name

7 Loading PL/SQL Server Pages
Loading psp document to Oracle loadpsp [ -replace ] -user [ include_file_name ... ] [ error_file_name ] psp_file_name ...

8 More Syntax Statements Expression Conditional blocks
<% PL/SQL Statement; [ PL/SQL Statement; ] … %> Expression <%= PL/SQL Expression %> Conditional blocks <% if condition then %> [HTML code] <% else %> <% end if; %>

9 More Syntax Including files PL/SQL declarations
include file="path name" %> PL/SQL declarations <%! PL/SQL declaration; [ PL/SQL declaration; ] ... %>

10 PSP Example: Grade Book
First page: get_access.psp Overview: Allows login to application page language="PL/SQL" %> plsql procedure="get_access" %> <HTML> <HEAD> <TITLE>Get password</TITLE> <H1>Grade Book Access Page</H1> </HEAD> (cont. next slide)

11 PSP Example: Grade Book
<BODY> <FORM ACTION="<%=owa_util.get_owa_service_path%>start_session" METHOD="POST"> <BR> Today is <%=to_char(sysdate, 'Day')%>, <%=to_char(sysdate, 'Dd / Mon / YYYY HH:MI AM')%> <BR><BR> (cont. next slide)

12 PSP Example: Grade Book
<TABLE><TR> <TD><STRONG>USER ID: </STRONG></TD> <TD><INPUT TYPE="text" NAME="usid" SIZE="20" MAXLENGTH="50"></TD> </TR> <TR> <TD><STRONG>PASSWORD: </STRONG></TD> <TD><INPUT TYPE="password" NAME="passwd" SIZE="20" MAXLENGTH="50"></TD> </TR></TABLE> <INPUT TYPE="submit" VALUE=" Proceed "> <INPUT TYPE="reset" VALUE="Reset"> </FORM></BODY></HTML>

13 PSP Example: Grade Book

14 Form Processing This form processing program does not generate any HTML code. Therefore, we leave it as a PL/SQL program (start_session.sql) create or replace procedure start_session( usid in varchar2 DEFAULT NULL, passwd in varchar2 DEFAULT NULL) AS begin select A.userid, A.password, A.lastAccess, A.authority into user_buffer, passwd_buffer, time_buffer, auth_buffer from users A where upper(A.userid)=upper(start_session.usid); end start_session;

15 Form Processing in PSP Example: <%@ page language="PL/SQL" %>
plsql procedure="teacher_menu" %> plsql parameter="u_access" type="varchar2" default="null" %> plsql parameter="userid" type="varchar2" default="null" %>


Download ppt "PL/SQL Server Pages (Web Programming with PL/SQL)"

Similar presentations


Ads by Google