XHTML and JTidy
Hi,
I have converted a html file to xhtml using JTidy. Now I'm trying to extract data from it. I have to following line to parse:
<h2 class=r>
<a class=l href="http://www.java.com/" onmousedown="return clk(this.href,'','','res','1','')">
<b>java</b>.com: Hot Games, Cool Apps</a></h2>
I want to extract the text in between the h2 tags , namely "java.com: Hot Games, cool Apps". At the moment it does'nt extract anything , i think because of the <b> tags. This is the code I'm using:
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true); // never forget this! DocumentBuilder builder = domFactory.newDocumentBuilder();
Document document = tidy.parseDOM(in, System.out);
NodeList sections = document.getElementsByTagName ( "h2" ) ;
int numSections = sections.getLength ( ) ;
System.out.println(numSections);
for ( int i = 0; i < numSections; i++ )
Element section = ( Element ) sections.item ( i ) ;
Node title = section.getFirstChild ( ) ;
while ( title != null && title.getNodeType ( ) != Node.ELEMENT_NODE )
title = title.getNextSibling ( ) ;
if ( title!=null )
System.out.println ( title.getFirstChild ( ) .getNodeValue ( ) ) ;
Is there a way to ignore tags when when traversing a DOM document?
Thanks
Node.getTextContent()... in Java 5, otherwise traverse the DOM tree below the "h2" element and append each text node as you come to it.
Similar Messages
-
Oracle ADF conformity with XHTML and DOM Level 2
Dear all,
I wonder if Oracle ADF 10g can produce documents that confirm with the XHTML and DOM Level 2 standards. I searched in Google but it is little hard to figure outOk, but I taught that after importing myModel2 in myModel1, Jdeveloper realise a merge and it visualizes a unique package, even if it is splitted on two or more projects/models.
So that, it seems to me this procedure is useful for importing jar file, but not for splitting a very big project in a lot of smaller projects, doesn't it?
Thanks for your opinion
Andrea -
HTML AIR apps.. use XHTML and Doctypes?
I was just wondering, as I'm looking through the documentation on how to create an AIR application using HTML, and the example shows html without a doctype declaration or xhtml syntax.
I'm just curious if xhtml and doctype should be used or if it even makes a difference.
I'm assuming that either way, once I get the layout to look the way I want it to, that visually after it's compiled it won't change since the runtime is the same on all operating systems?Updated my os
Brand new Mac ... what exactly needed updating?
Which OS X is installed?
Click the Apple () menu top left in your screen. From the drop down menu click About This Mac.
The version is noted there. -
Does EP 7 supports xHtml and css files?
Hello,
Does EP 7 supports xHtml and css files?
Regards
Sunil KulkarniAs I mentioned to Sergio, it was probably when I switched back to flows_010500. When I did
wwv_upgrade.switch_schemas('FLOWS_010500', 'FLOWS_010600');
I was logged in as FLOWS_010600. However when I switched back using
wwv_upgrade.switch_schemas('FLOWS_010600', 'FLOWS_010500');
I was still logged in as FLOWS_010600. I believe that's the mistake; I should have been logged in as FLOWS_010500 to switch back to FLOWS_010500. I remember seeing this somewhere in the doc (that you should be logged in as the user you are migrating/reverting to), but it doesn't appear to be enforced.
In any case, thanks Sergio for the quick and easy fix! I'm now going to re-install the flows_010600 user and hope that things go smoothly this time. -
What version of XHTML and CSS are in Safari 3.2.1
hello
do you know what up to date versions of XHTML and CSS are in Safari 3.2.1
Before i decided to post here i did look at other options, the developers seem to have their own club.
and there was not much other choice on the front page of the forums.
I did try looking through the reference library, http://developer.apple.com/referencelibrary/
where else could i look to find what versions of XHTML and CSS are in Safari 3.2.1
and any other interesting specs.
thank you for your time in this matter.
JamesHi,
When you say you looked through the reference library, did you see [this page|http://developer.apple.com/referencelibrary/InternetWeb/idxWebContent-date .html]?
It doesn't mention explicit version numbers but claims to tell you what functionality is supported.
Safari handles CSS2.1 and a growing number of CSS3 declarations. Work is also ongoing on [adding HTML5 support|http://webkit.org/blog/140/html5-media-support>, but I don't know if any of it has made the release version of Safari yet. -
Jsps, xhtml and Internet Explorer
Hi there,
anoyone know this one?
I have a jsp page written to the xhtml standard. It looks like this:
<?xml version="1.0"?>
<!--
- Author(s):
- Date:
- Copyright Notice:
- Description:
-->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:html="/WEB-INF/struts-html.tld"
xmlns:bean="/WEB-INF/struts-bean.tld"
xmlns:dt="http://jakarta.apache.org/taglibs/datetime-1.0"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:fmt="http://java.sun.com/jstl/fmt"
version="1.2">
<html:html xhtml="true">
<head>
</head>
<body>
</body>
</html:html>
</jsp:root>
All seems fine. The page compiles properly and looks nice on every browser I've
tried. Except Internet Explorer (v6), where it simply displays the XML source tree.
I tried adding:
<mime-mapping>
<extension>jsp</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
(and simlarly for xhtml) to the web.xml (both the webapp one and the global one).
I'm using tomcat 4.0.6 and java 1.4.1 (I can't easily upgrade these because this is what my client use).
Has anyone seen this before?
Many thanks,
Grahammaybe cuz you are missing the DOCTYPE declaration.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -
How import xhtml and css in Indesign?
I have 100 pages XHTML document and related css.
how we import the files in Indesign?
Is it Indesign server help us? How?
Thanks in advance
Sankar VenkatThe original query posted would match EITHER a digit and uppercase pair OR a digit and | (pipes or bar symbol) pair and Salah's expressions will match a digit and any upper or lowercase
If the object is to match only a digit and uppercase pair and separate them with a sixth space, I would use: (\d)(\u) and (\u)(\d) for the find expressions and $1~%$2 for the change -
Lifet After HTML/XHTML and CSS
Since I could not afford going to college for web design, I
relied on books, articles and this forum to jump start my knowledge
on web development. I will never be an "expert" on web development.
I say this because the web language and technology is constantly
changing and one must keep up with today's craving for digital
supremacy.
Few months ago I was unable to create a web page with out
Dreamweaver design view but now, I hate design view. I sit and
create web pages in note pad all day and I love it! I love writing
raw codes and my dream is to become one of the best web developer
some day.
Anyway, I have learned a lot about CSS/XHTML to at least
create basic websites but I want to take the next step since I can
now afford to take college classes.
What do I learn next? I want to learn another language that
will enhanced my design/developer technical knowledge. Do I go
JavaScript? Flash/Actionscript?
I want to learn a technology that can create interactivity on
the web but with all the different languages, I'm confused as to
where to start.
Any advise?
PatrickOn 01 Aug 2008 in macromedia.dreamweaver, Webethics wrote:
> Since I could not afford going to college for web
design, I relied
> on books, articles and this forum to jump start my
knowledge on web
> development. I will never be an "expert" on web
development.
Many of us have backgrounds in areas other than web
development, and
learned it the same way you did.
> I say this because the web language and technology is
constantly
> changing and one must keep up with today's craving for
digital
> supremacy.
However - (X)HTML and CSS are the backbone of web
development, and will
remain so for the forseeable future. (Like until
October...)[1]
> Few months ago I was unable to create a web page with
out
> Dreamweaver design view but now, I hate design view. I
sit and
> create web pages in note pad all day and I love it! I
love writing
> raw codes and my dream is to become one of the best web
developer
> some day.
I can - and do - some development in a text editor. However,
the
conveniences Dreamweaver adds - things like tag completion
and file
management - mean that I do most of my work in DW's code
view.
> Anyway, I have learned a lot about CSS/XHTML to at least
create
> basic websites but I want to take the next step since I
can now
> afford to take college classes.
>
> What do I learn next? I want to learn another language
that will
> enhanced my design/developer technical knowledge. Do I
go
> JavaScript? Flash/Actionscript?
>
> I want to learn a technology that can create
interactivity on the
> web but with all the different languages, I'm confused
as to where
> to start .
Learn serverside scripting, either PHP or ASP.Net/C# or maybe
.Net/jscript. Check the want ads or online job boards for
what
companies are looking for in the area you want to work.
There is some work out there for Flash developers, either as
part of a
team or as a subcontractor, doing parts of sites. A lot of
sites I see
use a Flash header to add some interest to a page. But the
number of
straight Flash sites is limited, and I suspect will be for a
while.
Javascript is good too, and some people make a living from
creating
javascript widgets for web development. See, for example,
Project
Seven (
http://projectseven.com/) or
Michael Brandt (Diva HTML
http://www.divahtml.com/).
And a competent web developer should have a
passing familiarity with it. But I'd guess that you're
unlikely to
land a local development job based on your javascript
abilities.
[1] For the humor impaired - I'm kidding. It will be November
at
least. I'm not sure what the year will be, though.
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/contact.php -
Internet Explorer, xhtml and JSF
I'm having a problem with an app I'm developing in xhtml using the xml format for my jsp files. I've been using Firefox during development and have had no problems. However, today I loaded the site in IE and got the following error:
Entity names, PI targets, notation names and attribute values declared to be of
types ID, IDREF(S), ENTITY(IES) or NOTATION cannot contain any colons.The error refers to the following element:
<input id="_id4:subcontractorId" type="hidden" name="_id4:subcontractorId" value="2" />From a quick bit of googling, it seems that Microsoft have implemented XML namespaces in the XML parser for IE with no fall-back if the document does not conform to this. The spec for XML namespaces says the following:
The effect of conformance is that in such a document:
* All element types and attribute names contain either zero or one colon.
* No entity names, PI targets, or notation names contain any colons.
Strictly speaking, attribute values declared to be of types ID, IDREF(S), ENTITY(IES), and NOTATION are also Names, and thus should be colon-free.
It seems therefore that jsf is producing invalid xml as far as IE is concerned. Is there any way I can work around this without re-writing all my jsps to produce html?
Example jsp source file:
<?xml version="1.0" ?>
<jsp:root version="2.0"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<f:view>
<f:verbatim><![CDATA[<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">]]>
</f:verbatim>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="styles/subcontractor.css" rel="stylesheet" type="text/css"/>
<f:loadBundle basename="uk.co.motives.subcontractors.messages" var="msgs"/>
<title><h:outputText value="#{msgs.startTitle}"/></title>
</head>
<body>
<h2><h:outputText value="#{msgs.startTitle}"/></h2>
<h3><h:outputText value="#{msgs.startPrompt}"/></h3>
<h:form>
<h:commandButton
actionListener="#{subcontractorLoad.load}"
action="#{subcontractorLoad.getLoadOutcome}"
value="#{msgs.startSubcontractorLink}"/>
<h:inputHidden id="subcontractorId" value="2" />
</h:form>
<h:form>
<h:commandButton action="admin" value="#{msgs.startAdminLink}"/>
</h:form>
</body>
</html>
</f:view>
</jsp:root>Example outputted xhtml document (formatted):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link type="text/css" rel="stylesheet" href="styles/subcontractor.css"/>
<title>Welcome to the Subcontractors Database</title>
</head>
<body>
<h2>Welcome to the Subcontractors Database</h2>
<h3>Choose a task</h3>
<form id="_id4" method="post" action="/subcontractors/index.faces"
enctype="application/x-www-form-urlencoded">
<input type="submit" name="_id4:_id5" value="A subcontractor" />
<input id="_id4:subcontractorId" type="hidden" name="_id4:subcontractorId" value="2" />
<input type="hidden" name="_id4" value="_id4" />
</form>
<form id="_id6" method="post" action="/subcontractors/index.faces"
enctype="application/x-www-form-urlencoded">
<input type="submit" name="_id6:_id7" value="admin" />
<input type="hidden" name="_id6" value="_id6" />
</form>
</body>
</html>The JSF team is in the process of making the default HTML renderers generate HTML/XHML compliant markup.
The current EA4 release does not do that.
-roger -
Supporting XHTML and older browsers (IE6) in WLP 9.2
Hi
We're trying to have a Portal that renders XHTML-1.0-TRANSITIONAL content.
In order to support older browsers, we have content-override set to "text/html".
However, WLP renders the script tags that link directly to .js files with just one self-closing tag.
<script src="/front/framework/skins/shared/js/Utils2.0.js" type="text/javascript" />
This confuses browsers, as it should (for compatability reasons) close it with an end tag, with emtpy content.
<script src="/front/framework/skins/shared/js/Utils2.0.js" type="text/javascript"></script>
Is there any way to control this behaviour?
Skeleton.xml
<ns:skeleton xmlns:ns="http://www.bea.com/servers/portal/framework/laf/1.0.0">
<ns:render-format>
<ns:preset>XHTML_1_0_TRANSITIONAL</ns:preset>
<ns:content-type-overrides>
<ns:override content-type="text/html" classification="allbrowsers"/>
</ns:content-type-overrides>
</ns:render-format>
</ns:skeleton>
client-classifications.xml
<classification name="allbrowsers" description="For everything">
<useragent-regex value=".*" priority="5" />
</classification>
beehive-netui-config.xml
<jsp-tag-config>
<doctype>xhtml1-transitional</doctype>
</jsp-tag-config>
...Hi George and thank you for providing an answer to my problem.
We have actually worked around this. It's the same JS we are including on all pages, so we are doing this in head.jsp instead.
However, we have found another XHTML compliance problem. This is hopefully the last one though. ;)
When using NETUI, it will include a javascript for looking up tags by id.
<script language="JavaScript" type="text/JavaScript">
<!--
// lookup by tagId to "real id"
function lookupIdByTagId(id, tag)
var idScope = lookupIdScope(tag,".");
return (idScope == "") ? id : idScope + id;
//Non-Legacy lookup method creating a fully qualified scope id
function lookupIdScope(tag,sep)
var val = "";
if (sep == null) sep = "";
while (tag != null && tag.getAttribute != null) {
try {
var attrVal = tag.getAttribute("netui:idScope");
} catch (e) { /* ignore, in IE6 calling on a table results in an exception */ }
if (attrVal != null)
val = attrVal + sep + val;
tag = tag.parentNode;
return val;
// map tagId to "real name"
if (netui_tagIdNameMap == null)
var netui_tagIdNameMap = new Object();
netui_tagIdNameMap.newName="createDecistionTree_1{actionForm.newName}"
// lookup by tagId to "real name"
function lookupNameByTagId(id, tag)
var idScope = lookupIdScope(tag,"_");
if (idScope == "")
return netui_tagIdNameMap[id];
else
return netui_tagIdNameMap[idScope + "__" + id];
-->
</script>
The problem here is the language="JavaScript" part, since that is not valid XHTML.
I would have thought that NETUI should respect the <jsp-config><doc-type> set to XHTML, but maybe I'm overseeing something? -
Source-ordered XHTML and CSS site woes
Unfortunately, I am dealing with a site that has been built
across two generations of layout techniques. The client has also
followed the recommendation of a consultant and has fixed on
Contribute as their content editing method. This will not change
for the forseeable future. Half the site is table based tag-soup
bloat and the other half is source ordered CSS/XHTML. It's the
CSS/XHTML part that is giving us fits.
Contribute's web browser mode shows the site correctly.
However, once we move to draft mode the layout goes slightly askew
and we are unable to place the editing cursor on most of the
content. As it's all source ordered code what would be quickest is
to simply disable CSS display for draft mode. I can delete the CSS
files locally on my Mac with some fumbling and see the unstyled
page to edit. On Windows machines, and the client's machines are
all Windows XP boxes, and even after I do find the CSS files local
directory (Internet Temporary Files) delete them the draft editor
still displays the wonky rendering.
My question then is how can I get Contribute to ignore the
CSS while the client tries to update pages? Or, is there another
path to take to get the client up and running with Contribute
and valid CSS/XHTML? As it is, I would have to strongly
recommend against any client using Contribute until it can work
with web-standards based layouts.Unfortunately, I am dealing with a site that has been built
across two generations of layout techniques. The client has also
followed the recommendation of a consultant and has fixed on
Contribute as their content editing method. This will not change
for the forseeable future. Half the site is table based tag-soup
bloat and the other half is source ordered CSS/XHTML. It's the
CSS/XHTML part that is giving us fits.
Contribute's web browser mode shows the site correctly.
However, once we move to draft mode the layout goes slightly askew
and we are unable to place the editing cursor on most of the
content. As it's all source ordered code what would be quickest is
to simply disable CSS display for draft mode. I can delete the CSS
files locally on my Mac with some fumbling and see the unstyled
page to edit. On Windows machines, and the client's machines are
all Windows XP boxes, and even after I do find the CSS files local
directory (Internet Temporary Files) delete them the draft editor
still displays the wonky rendering.
My question then is how can I get Contribute to ignore the
CSS while the client tries to update pages? Or, is there another
path to take to get the client up and running with Contribute
and valid CSS/XHTML? As it is, I would have to strongly
recommend against any client using Contribute until it can work
with web-standards based layouts. -
Hi Guys,
Another one of those newbie questions. Ive designed many
sites in Dreamweaver, using the layout pane, with the Layout table
and Draw Layout Cell tools to divide and arrange the page the way I
want it. Im going to be looking into producing valid xhtml &
CSS sites, as that seems to be the best way to go forwards (until
something new comes out) and from the what I read, the Layout table
and Draw Layout Cell is going to produce sites that aren't valid.
I'm quite comfortable with understanding how to use
Dreamweaver with a CSS stylesheet, using the properties pane on the
right of the screen. How on earth do I split the page design up
without using Draw Layout Cell/Layout table tool though? I'd
basically like to start with a header, left bar, content area and
then footer. When I've mastered this, the layout I want to create
is alot more complex. Can this be done in dreamweaver using one of
the drag and drop tools or am I going to have to get my hands dirty
and learn code, which i'm despertaely trying to avoid at this
point?
Many Thanks to all that reply!
JalzTry this
http://css.maxdesign.com.au/floatutorial/
But you'll have to get your hands dirty.. but don't worry it
really not
that difficult. I recommend split view so you can see what
happens while
you work your way through tutorial 8
HTH
Kim
Jalz skrev:
> Hi Guys,
>
> Another one of those newbie questions. Ive designed many
sites in Dreamweaver,
> using the layout pane, with the Layout table and Draw
Layout Cell tools to
> divide and arrange the page the way I want it. Im going
to be looking into
> producing valid xhtml & CSS sites, as that seems to
be the best way to go
> forwards (until something new comes out) and from the
what I read, the Layout
> table and Draw Layout Cell is going to produce sites
that aren't valid.
>
> I'm quite comfortable with understanding how to use
Dreamweaver with a CSS
> stylesheet, using the properties pane on the right of
the screen. How on earth
> do I split the page design up without using Draw Layout
Cell/Layout table tool
> though? I'd basically like to start with a header, left
bar, content area and
> then footer. When I've mastered this, the layout I want
to create is alot more
> complex. Can this be done in dreamweaver using one of
the drag and drop tools
> or am I going to have to get my hands dirty and learn
code, which i'm
> despertaely trying to avoid at this point?
>
> Many Thanks to all that reply!
>
> Jalz
> -
How do I generate XHTML code using the EA4 implementation?
I only get, e.g.
<img id="graphics" src="mylogo.gif">
<input type="text" name="line" value="" size="10" >
instead of
<img id="graphics" src="mylogo.gif"/>
<input type="text" name="line" value="" size="10"/>
Any hint is appreciated!The JSF team is in the process of making the default HTML renderers generate HTML/XHML compliant markup.
The current EA4 release does not do that.
-roger -
PL/SQL Server Pages (PSPs) and CSS
Hi,
I am used to creating standards compliant websites using XHTML and CSS and some other application language for dynamic content. I have recently started working with PL/SQL and want to create an application using PSPs. I was wondering the best way to go about including CSS in an application, because it doesn't make sense to duplication the CSS on each page, but since the PSP is converted to a procedure this seesm to be the only way to include CSS?
Any ideas on best practice for using CSS with PSPs?I think you should be able to put all your CSS into a single file, or only a few files, like in a normal web project and that you can include this file using the regular HTML tag.
You store your CSS file(s) in a folder that is accessible by your website. Normally this is achieved by adding an Alias in the Apache webserver that is embedded in the Oracle database.
If I remember it correctly (it has been a while since I saw the embedded webserver) your request for your PSP goes to an url like http://your.server.com/pls/your_page. Everything of the url that comes after /pls/ is handled by the mod_plsql Apache module that is repsonsible for sending the request to the database and returning the result to the screen.
If you can define an alias like 'css' (without the quotes), which makes the url something like http://your.server.com/css/, then you can try to include your CSS file(s) referring to /css/file.css. Once you get this working, you can do the same for images.
This is a generic approach that can get you started hopefully.
Good luck.
I hope this can get you started. Information on the alias can be found -
Using a composite component from an xhtml that is included in another xhtml
JBoss 7.1.1
JSF 2.1
I have the following composite component:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:component xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:rich="http://richfaces.org/rich">
<composite:interface>
<composite:attribute name="for" required="true" />
</composite:interface>
<composite:implementation>
<rich:panel styleClass="aas-msg-tt-p">
<rich:message id="#{cc.attrs.for}-msg"
for="#{cc.attrs.for}" />
<rich:tooltip id="#{cc.attrs.for}-msg-tt">
<rich:message for="#{cc.attrs.for}"
styleClass="aas-rf-det-tooltip" />
</rich:tooltip>
</rich:panel>
</composite:implementation>
</ui:component>It is in WebContent/resources/aas-composite/messagetooltip.xhtml ( where WebContent is the root directory or root context directory of the deployed WAR )
h3. *1. Using the composite component and working as expected*
If I use the composite component directly as follows, it all works:
1) Create test.xhtml in WebContent
2) Content of test.xhtml as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:aas="http://java.sun.com/jsf/composite/aas-composite">
<h:head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
</h:head>
<h:body>
<h:outputStylesheet library="css" name="richfacesoverrides.css"/>
<h:form id="testform">
<table>
<tr>
<td><aas:messagetooltip for="id2"/></td>
<td><h:outputLabel>Input 2: </h:outputLabel></td>
<td><h:selectOneMenu id="id2"
required="true"
requiredMessage="Cause of Death is required"
value="${death.causeOfDeath}">
<f:selectItem itemValue="" itemLabel="-- Select One --" />
<f:selectItem itemValue="COD01" itemLabel="Cancer" />
<f:selectItem itemValue="COD02" itemLabel="Diabetes" />
<f:selectItem itemValue="COD11" itemLabel="Other" />
</h:selectOneMenu>
</td>
</tr>
</table>
<h:commandButton id="submit" value="Submit"/><br/>
</h:form>
</h:body>
</html>3) Deploy and test, all good
h3. *2. Using the composite component but NOT working as expected*
Now if I use the composite component as follows:
4) Create XHTML file called includeThisFromRoot.xhtml under WebContent directory
5) with content as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:aas="http://java.sun.com/jsf/composite/aas-composite">
<ui:composition>
<table>
<tr>
<td><aas:messagetooltip for="id2"/></td>
<td><h:outputLabel>Input 2: </h:outputLabel></td>
<td><h:selectOneMenu id="id2"
required="true"
requiredMessage="Cause of Death is required"
value="${death.causeOfDeath}">
<f:selectItem itemValue="" itemLabel="-- Select One --" />
<f:selectItem itemValue="COD01" itemLabel="Cancer" />
<f:selectItem itemValue="COD02" itemLabel="Diabetes" />
<f:selectItem itemValue="COD11" itemLabel="Other" />
</h:selectOneMenu>
</td>
</tr>
</table>
<h:commandButton id="submit" value="Submit"/><br/>
</ui:composition>
</html>6) Make a copy test.xhtml, but call the new one testWithInclude.xhtml, with content as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:aas="http://java.sun.com/jsf/composite/aas-composite">
<h:head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
</h:head>
<h:body>
<h:outputStylesheet library="css" name="richfacesoverrides.css"/>
<h:form id="testform">
<ui:include src="includeThisFromRoot.xhtml" />
</h:form>
</h:body>
</html>h3. Summary of change
You can see here that I simply moved all of the content between the form tags from the original XHTML to a separate XHTML, and included that separate XHTML using <ui:include>.
h3. Result
7) Deploy and access testWithInclude.jsf from browser, and I get:
15:17:55,310 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/richfacestest].[Faces Servlet]] (http--0.0.0.0-8081-5) Servlet.service() for servlet Faces Servlet threw exception: javax.faces.view.facelets.TagException: /includeThisFromRoot.xhtml @13,52 <aas:messagetooltip> Tag Library supports namespace: http://java.sun.com/jsf/composite/aas-composite, but no tag was defined for name: messagetooltip
at com.sun.faces.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:304) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.facelets.compiler.SAXCompiler$CompilationHandler.startElement(SAXCompiler.java:266) [jsf-impl-2.1.7-jbossorg-2.jar:]
at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:496)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:180)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:810)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:275)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1653)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)
at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:555)
at org.apache.xerces.jaxp.SAXParserImpl.parse(SAXParserImpl.java:289)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195) [rt.jar:1.7.0_09]
at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:434) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:410) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.facelets.compiler.Compiler.compile(Compiler.java:124) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.facelets.impl.DefaultFaceletFactory.createFacelet(DefaultFaceletFactory.java:305) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.facelets.impl.DefaultFaceletFactory.access$100(DefaultFaceletFactory.java:93) [jsf-impl-2.1.7-jbossorg-2.jar:]
at com.sun.faces.facelets.impl.DefaultFaceletFactory$1.newInstance(DefaultFaceletFactory.java:160) [jsf-impl-2.1.7-jbossorg-2.jar:]What gives ? Am I missing something simple ?I think I may have found a workaround.
In the XHTML file that is included and using the composite component, add the namespace as part of the custom component, like so:
<aas:messagetooltip xmlns:aas="http://java.sun.com/jsf/composite/aas-composite" for="id2"/>So that it now becomes:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:aas="http://java.sun.com/jsf/composite/aas-composite">
<ui:composition>
<table>
<tr>
<td><aas:messagetooltip xmlns:aas="http://java.sun.com/jsf/composite/aas-composite" for="id2"/></td>
<td><h:outputLabel>Input 2: </h:outputLabel></td>
<td><h:selectOneMenu id="id2"
required="true"
requiredMessage="Cause of Death is required"
value="${death.causeOfDeath}">
<f:selectItem itemValue="" itemLabel="-- Select One --" />
<f:selectItem itemValue="COD01" itemLabel="Cancer" />
<f:selectItem itemValue="COD02" itemLabel="Diabetes" />
<f:selectItem itemValue="COD11" itemLabel="Other" />
</h:selectOneMenu>
</td>
</tr>
</table>
<h:commandButton id="submit" value="Submit"/><br/>
</ui:composition>
</html>I tried this after finding a similar bug about nested composite components, which I do not use, but thought I would give it a try:
http://stackoverflow.com/questions/10898906/myfoo-tag-library-supports-namespace-http-java-sun-com-jsf-composite-mycom
http://stackoverflow.com/questions/9735593/nested-composite-component-broken-in-jboss-7-1-1
Have to keep track of all these workarounds that I am doing.
Maybe you are looking for
-
I recently installed Itunes on a computer with windows xp. At first it recognized my Iphone 4s and Ipod classic 160 g. Went through the standard procedure for registering both products and everything seemed fine. Then I started importing my cd collec
-
Can't show the configuration on Cisco 4503-E
I have cisco 4503-E as my core switch. When I want to read or save configuration it show "NVRAM: Unable to read configuration. Try again later." Somebody said the cause of simultaneous access to NVRAM. I use "show users" to see the access users but
-
Personnel number in CATS_DA with BAdI
I would like to fill the personnel number automaticly in transaction CATS_DA. Re: Select-options in CATS_DA using BAdI gave me some hints, but it's still not working the way it should. Does anyone has some example code for the method INITIALIZATION a
-
Garageband 10.0.1 non trovo il sound effects
Italiano: Salve , in garageband 10.0.1 su Mac OS X 10.9.1 non trovo nella dispozione LEGACY il file SOUN EFFECTS per creare con la keyboard la riproduzione di samples . Per cortesia , qualcuno sa come devo fare? English : in garageband 10.0.1 on Mac
-
I'm getting a cwinstr error after upgrading from labview 7.0 to labview 2010
Hello recently upgraged a PC from Labview 7.0 pro to Labview 2010 pro. Now I can not open a calibration executable we been using for a xantrex xfr power supply (unfortunately I don't have source code). The only error I get is "cwinstr-can't load pro