JSF 2 : to inject HTML into ADF Faces you must use the verbatim tag

2,768 views
Skip to first unread message

Jan Vervecken

unread,
Apr 22, 2014, 10:02:53 AM4/22/14
to adf-met...@googlegroups.com
hi

In the context of ADFEMG JIRA issue ADFEMG-219 [1] there was this feedback :
"... to inject HTML into ADF Faces you must use the verbatim tag ..."

At the same time, the Oracle documentation [2] refers to an Oracle white paper [3] about JSF 2 that says :
"... New in JSF 2.0, the view declaration language (VDL) API defines the contract between the JSF runtime and the view technology used to host the JSF component tags. Before version 2.0 of JSF, Java Server Pages (JSP) was used as the default way to produce the JSF component tree at runtime. Unfortunately, the JSP request lifecycle, a simple parse-compile-render process, is not integrated with the more complex JSF request lifecycle. Commonly, because of this lifecycle mismatch, developers who used HTML and JSTL tags in the context of JSF views defined within JSP had to deal with unpredictable results in page rendering.
JSF 2.0 introduces Facelets as the new default view declaration language. The introduction of Facelets addresses the shortcomings of JSP and improves the developer page design and reuse experience. ... The content of a Facelets document is a contribution of HTML markup defining layout, JSF component references, ...
"

Should it be possible to mix HTML markup and ADF Faces components on Facelets pages using JDeveloper 12c ?

References to documentation that confirm/deny this are welcome.

- [1] "12c: html inside af:showDetailItem giving error" at https://java.net/jira/browse/ADFEMG-219
- [2] section "1.2 ADF Faces Framework"
at http://docs.oracle.com/middleware/1212/adf/ADFUI/gs_intro.htm#ADFUI915
- [3] "JavaServer Faces 2.0 Overview and Adoption Roadmap in Oracle ADF Faces and Oracle JDeveloper 11g"
at http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adffaces-jsf20-190927.pdf

many thanks
Jan Vervecken

John Flack

unread,
Apr 22, 2014, 10:24:10 AM4/22/14
to adf-met...@googlegroups.com

I’ve been experimenting with that very thing – use of HTML in a Facelets page with ADF Faces.  What you need to do is reference the XHTML namespace in your page - xmlns="http://www.w3.org/1999/xhtml" before you write HTML.  It needs to follow the XHTML standard – i.e. all elements closed, all attribute values enclosed in quotes, because JSF pages should be valid XML.  You do not need to put the HTML in a verbatim section.  So far, this works perfectly well, even in an ADF template, but it doesn’t always look correct in the Design View.  Frankly, I think the new Design View in 12c needs some work – can’t wait for the first 12c patch release.

 

The only thing that I’m having trouble with in my experimental application is af:table – the columns aren’t lining up properly.  But I haven’t isolated this to know whether it is the HTML in my page, or something else that causes this.

Yannick Ongena

unread,
Apr 22, 2014, 10:32:17 AM4/22/14
to adf-met...@googlegroups.com

Wouldn’t mixing HTML with ADF give a problem with the PPR and ADF JS framework?

I know the ADF JS rely heavily on the DOM tree and if you manipulate this tree without ADF knowing you changed it, it will break some PPR functionality.

I know this can be the case when working with JQuery and I always thought this was the same issue when injecting raw HTML into your pages.

 

Regards

Yannick

--
--
You received this message because you are subscribed to the ADF Enterprise Methodology Group (http://groups.google.com/group/adf-methodology). To unsubscribe send email to adf-methodolo...@googlegroups.com
 
All content to the ADF EMG lies under the Creative Commons Attribution 3.0 Unported License (http://creativecommons.org/licenses/by/3.0/). Any content sourced must be attributed back to the ADF EMG with a link to the Google Group (http://groups.google.com/group/adf-methodology).

---
You received this message because you are subscribed to the Google Groups "ADF Enterprise Methodology Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adf-methodolo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Blake Sullivan

unread,
Apr 22, 2014, 12:25:35 PM4/22/14
to adf-met...@googlegroups.com
ADF tries to only manipulate DOM that it rendered, so you are usually fine.  The one exception is if you have JavaScript that cares about the execution context when the JavaScript is executed.  If your JavaScript expects that some associated DOM is attached to the document when the JavaScript in parsed, you can have problems when your HTML script element is PPR'ed (which is one of the things that the ADF script and resource tags take care of for you).

-- Blake Sullivan

Jan Vervecken

unread,
Apr 22, 2014, 2:51:12 PM4/22/14
to adf-met...@googlegroups.com
Thanks for your reply John.

Thanks for sharing your experience, and for mentioning "... You do not need to put the HTML in a verbatim section. ...".

regards
Jan Vervecken

Jan Vervecken

unread,
Apr 22, 2014, 2:53:54 PM4/22/14
to adf-met...@googlegroups.com
Thanks for your reply Yannick.

- about "Wouldn’t mixing HTML with ADF give a problem with the PPR and ADF JS framework? "
-- Thanks for mentioning JavaScript as relevant, but the question intended to focus on ADF Faces and how it allows to benefit from the Facelets idea that "improves the developer page design ... experience" [1] from a layout and style perspective.

Pointers to Oracle documenting what kind of mixing of HTML markup is "allowed", are still welcome.

- [1] "JavaServer Faces 2.0 Overview and Adoption Roadmap in Oracle ADF Faces and Oracle JDeveloper 11g"
at http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adffaces-jsf20-190927.pdf

regards
Jan Vervecken

Jan Vervecken

unread,
Apr 22, 2014, 2:54:50 PM4/22/14
to adf-met...@googlegroups.com
Thanks for your reply Blake.

- about "ADF tries to only manipulate DOM that it rendered, so you are usually fine. ..."
-- So, does "usually fine" imply that the HtmlResponseWriter errors should not occur in the "relatively straightforward" scenario
at https://java.net/jira/browse/ADFEMG-219 ?

Also, pointers to Oracle documenting what kind of mixing of HTML markup is "allowed", are still welcome.

regards
Jan Vervecken

Blake Sullivan

unread,
Apr 22, 2014, 3:31:57 PM4/22/14
to adf-met...@googlegroups.com
Looks like a bug in the _skippedElements handling of the Trindiad HtmlResponseWriter

-- Blake Sullivan
Reply all
Reply to author
Forward
0 new messages