Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: package htp

Re: package htp

From: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: Tue, 06 Nov 2007 21:46:57 +0100
Message-ID: <fgqjrq$q8e$1@news2.zwoll1.ov.home.nl>


Jake wrote:

>
> By "painful" I was refering to all the frame() formOpen()
> framesSetOpen() noframesClose() functions/procedures in the htp
> package just to make a web page. I'll have to check out the other
> ways of doing it though.
>

What I meant with "wrapper".
How's this for a page from pl/sql:

   PROCEDURE LOGOUT (p_str IN VARCHAR2 DEFAULT 'Session ended')    IS
   BEGIN

      BEGIN
         g_cookie := owa_cookie.get ('MySecretCookie');
      EXCEPTION
         WHEN OTHERS
         THEN
            NULL;
      END;

      IF g_cookie.num_vals > 0
      THEN
         BEGIN
            DELETE FROM session_table
                  WHERE session_id = g_cookie.vals (1);

            OWA_UTIL.mime_header ('text/html', FALSE);
            owa_cookie.remove (NAME => 'MySecretCookie', val =>
g_cookie.vals (1));
            OWA_UTIL.http_header_close;
         EXCEPTION
            WHEN OTHERS
            THEN
               HTP.p (format.errorpage (SQLERRM));
         END;
      END IF;

      HTP.p (format.infopage (p_info => p_str));
   END LOGOUT; Mind you - it's a lot of processing - the page is actually built in one statement:
HTP.p (format.infopage (p_info => p_str));

If an error occurs, the error page is built with this: HTP.p (format.errorpage (SQLERRM));

Other examples:
Hyperlink, with alternative text, link and pop-up description:

HTP.p (format.hyperlink (p_text  => 'Home',
                         p_destination => 'myapp.bpage1',
                         p_title  => 'Back to start page' ));

Build a HTML table, based on an oracle database table, with flexible where clause - no row limit:
HTP.p (htmlform.selecttable

           (label            => 'Profile:',
            NAME             => 'p_profiel',
            tablename        => 'myapppr.profiles',
            textcol          => 'profile',
            valuecol         => 'id',
            orderby          => 'id',
            wherecondition   => 'profile not in
(''ADMINISTRATOR'',''MAINTENANCE'')',
             p_default       => r_sel_pd.profiel_id ));

Etc, etc, etc.

So - where's the pain?

-- 
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
Received on Tue Nov 06 2007 - 14:46:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US