Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

Thursday, July 22, 2010

Double DOCTYPE, jsp:output, trh:html (trinidad) and JDeveloper wizards

This the result when you click "new JSF Page" "wizard"
and use "*.jspx" and "Render in mobile device" option.


<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:dvtt="http://xmlns.oracle.com/dss/trinidad/faces">
<jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<trh:html>
....


This however has one major problem,
produces invalid HTML markup with DOUBLED DOCTYPE.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="ltr" lang="en-US">
....


This is because one is produced by
jsp:output
and another by
thr:html + org.apache.myfaces.trinidad.core renderkit
(which is default for JDeveloper 11.1.1.3.0 and "ADF Mobile")
It seems just like coincidence that both are the same (read more...)

Solution:
As far as I hnow, the thr:html does not have "none" option for "Mode"
see http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/trh_html.html
So the best is to remove all doctype-* from jsp:output.
Actually if reading the JSP spec for omit-xml-declaration, you can remove whole
jsp:output because:
omit-xml-declaration....
The default value for a JSP document that has a jsp:root element is “yes”.

To bring some more info: the actual DOCTYPES rendere for MSIE 7.0 with
various swiches are:


default (damned again ?):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
S S A A A A A A Q

quirks:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Q Q Q Q Q Q Q Q Q

strict (this should be default in 2010 !!!):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
S S S S S A A A A


The letters are modes for specific browsers taken from:
http://hsivonen.iki.fi/doctype/

Wednesday, July 21, 2010

ADF Rich client Demo - incomplete HTML, user agent detection

Request

GET http://jdevadf.oracle.com/adf-richclient-demo/faces/index.jspx?gallery=true&_afrLoop=22766204435448480&_afrWindowMode=0&_afrWindowId=null HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: xxxxxxxxxxxxx

Produces this incomplete markup:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html dir="ltr" lang="en-US"><head id="d1__xc_h"><title>ADF Faces Rich Client Demos</title><meta name="generator" content="Apache MyFaces Trinidad"><link rel="stylesheet" charset="UTF-8" type="text/css" href="/adf-richclient-demo/adf/styles/cache/blafplus-rich-desktop-bbz27h-en-ltr-hc-lf-cmp.css"><link rel="icon" type="image/png" href="/adf-richclient-demo/images/favicon.png"><link rel="apple-touch-icon" href="/adf-richclient-demo/images/touchicon.png"><script id="meta:metas1" type="text/javascript" src="/adf-richclient-demo/jsLibs/About.js"></script></head><body id="d1" onload="_checkLoadNoPPR()"><script type="text/javascript">var _AdfWindowOpenError='A popup window blocker has been detected in your browser. Popup blockers interfere with the operation of this application. Please disable your popup blocker or allow popups from this site.';</script><script type="text/javascript" src="/adf-richclient-demo/adf/jsLibs/Common1_2_12_1.js"></script><a name="top"></a><noscript>This page uses JavaScript and requires a JavaScript enabled browser.Your browser is not JavaScript enabled.</noscript><div id="tmplt"><form id="tmplt:ptf1" name="tmplt:ptf1" style="margin:0px" method="POST" onkeypress="return _submitOnEnter(event,'tmplt:ptf1');


Dig deeper, try to find docs....

ADF Rich Client Demo does not work in MSIE 7.0 with Native XHR disabled

http://jdevadf.oracle.com/adf-richclient-demo/faces/index.jspx
Is this suposed to work in MSIE 7.0 ? I hope so but not with
Native HMLHttp request disabled in MSIE configuration ;-)



AdfXMLRequest.superclass.Init.call(this);
this.isSynchronous=false;
this.callback=null;
this._state=AdfXMLRequest.UNINITIALIZED;
this.headers= new Object();
this.xmlhttp= new XMLHttpRequest();}


Any docs on this please ?

JSF, Trinidad, Oracle ADF Rich Client

I will start posting unsorted opinions about ADF in the next days
just to collect findings, subjective unproved hypothesis and mental shocks I'm ready to experience during my "late adoption".....

From JSF Specification:

Solving Practical Problems of the Web
JSF’s core architecture is designed to be independent of specific protocols and markup.
However it is also aimed directly at solving many of the common problems encountered
when writing applications for HTML clients that communicate via HTTP to a Java
application server that supports servlets and JavaServer Pages (JSP) based applications.

Or from ADF dev guide:

JavaServer Faces for Quick Learners
JSF 1.2 was chosen as the view layer of choice in Fusion web application development of Oracle
JDeveloper 11g. JSF is a Java EE standard since 2004 and in its current version 1.2 is part of the
Java EE 5 platform. JSF is designed to simplify web application development and changes the
programming model for building web pages from HTML markup development to the assembly
of reusable UI components that are declaratively linked to their data model and server-side event
handlers.

But does this gives us mandate to produce

Bad html (suboptimal, not semantic at all, or event invalid ?)
Bad css (obtrusive, uneffective,....)
Bad JavaScript (obtrusive, large, old fassioned ?)
and ignore most of URI and HTTP principles ?

and i'm not commenting on backend Java code yet ;-(