direct use of htp
Leo Van Nieuwenhuyse, January 04, 2008 - 3:03 am UTC
do not use it directly...
use APEX to have it all generated for you...
Although I'm an Apex-lover, there are so many cases (eg. pl/sql portlet development in Oracle Portal) where you need to use it directly.
I've been using them for more than 10 years, but I've also been discussing this topic with many developers for as many years.
Personally I stick to the prn procedure (clarity of code, minimal overhead, ability to generate xhtml, and last but not least: I just need to remember 1 and exactly 1 procedure to do the whole job). And when you look at the code generated by loadpsp: except for the mime header - which of course can't be generated using prn - it's just 1 procedure that is used: prn!.
But to broaden my view, any suggestions and points of view are welcome.
January 04, 2008 - 11:47 am UTC
but that would be exactly what I said?
...
There is no way I would be writing htp.p calls today in 2007 - every now and then in a snippet of code in APEX maybe - but no, not seriously.
....
Happy New year
A reader, January 04, 2008 - 5:02 am UTC
"There is no way I would be writing htp.p calls today in 2007". I think you mean 2008
January 04, 2008 - 11:51 am UTC
indeed.
Alessandro Nazzani, January 10, 2008 - 8:44 am UTC
>>> do not use it directly...
>>> use APEX to have it all generated for you...
>> Although I'm an Apex-lover, there are so many cases (eg.
>> pl/sql portlet development in Oracle Portal) where you
>> need to use it directly.
> but that would be exactly what I said?
Mmmh... perhaps my English is not good enough, but to me it doesn't sound like *exactly* the same thing...
Unfortunately sometimes (often?) ApEx is NOT an option.
> APEX uses the full suite of the API - the use htf.anchor and the like
Last time I checked, those API were printing all tags in uppercase, which destroys XHTML compliance.
> Use of the primitive 'prn' procedure, allowing to write
> real xhtml tags, and minimizing subprogramm outlining?
>
> Use of the somehow 'higher level' 'p' or 'print' procedures,
> also allowing to write real xhtml tags, allowing to format
> date and number variables, but requiring some overhead?
I think htp.print (same as htp.p) and htp.prn are the same, with the exception that the latter does NOT add a \n character. Am I wrong?
Alessandro
January 10, 2008 - 2:38 pm UTC
what I said was:
.... There is no way I would be writing htp.p calls today in 2007 - every now and then in a snippet of code in APEX maybe ...
that is what you are saying - there are tiny snippets you'll use here and there - but it would be responsible for something like 1% of the HTML on a page.
p versus print versus print
Leo Van Nieuwenhuyse, January 11, 2008 - 5:46 am UTC
Allesandro, you're allmost right.
But the main difference between prn and p is not only the newline character but also the level of the procedure:
prn itself is called again from p and print, so there's allways a little overhead:
your_procedure->htp.p->htp.prn
or
your_procedure->htp.print->htp.prn
generated html tags
Sri, January 27, 2014 - 9:38 pm UTC
Where are the generated code stored? Example:
CREATE OR REPLACE PROCEDURE hello AS
BEGIN
HTP.HTMLOPEN; -- generates <HTML>
HTP.HEADOPEN; -- generates <HEAD>
HTP.TITLE('Hello'); -- generates <TITLE>Hello</TITLE>
HTP.HEADCLOSE; -- generates </HEAD>
HTP.BODYOPEN; -- generates <BODY>
HTP.HEADER(1, 'Hello'); -- generates <H1>Hello</H1>
HTP.BODYCLOSE; -- generates </BODY>
HTP.HTMLCLOSE; -- generates </HTML>
END;
When I execute this procedure where does it send the output?
Thanks and appreciate your input.