Rendering HTML with/without PL/SQL in Oracle APEX (New Versions 24.X)
In older versions of Oracle APEX, developers often used the Region Type: PL/SQL Dynamic Content and wrote code with htp.p to directly print HTML to the page.
However, in newer versions APEX 23.2, 24.x , this region type has been deprecated. Oracle now recommends cleaner and safer methods to generate and display HTML, typically using templates and modern region types.
👉Render HTML in Oracle APEX:
1. Dynamic Content (Recommended)2. Using htp.p in PL/SQL Processes (Legacy), we should discuss it 😳
4. Reports with HTML Expressions
Let's Go :
1. Dynamic Content (Recommended)
Dynamic Content with PL/SQL Function Returning HTML
This is the official replacement for the old Dynamic PL/SQL Content. After this section in section 2 (Using htp.p in PL/SQL Processes), I will discuss it.
Example:
* This works exactly like htp.p
, but it returns the content instead of printing it.
2.Using htp.p in PL/SQL Processes (Legacy)
Although not recommended, you can still use htp.p
inside PL/SQL Processes or certain rendering points.
Example:
This approach is not supported for modern region rendering and should only be used in special cases.
3. Static Content Region
If your HTML is fixed and not generated dynamically, the easiest solution is:
-
Create a Static Content Region.
-
Place your HTML directly into the Source.
Example:
4. Reports with HTML Expressions
For dynamic data (like user lists, orders, etc.):
-
Create a Classic Report or an Interactive Report.
-
In the Column settings, use HTML Expression to render HTML in your results.
Example:
Use apex_escape.html when displaying user input to avoid XSS attacks.For Example:
Comments
Post a Comment