I am trying to use flowchart component in primefaces to view process flow but the connectors not appeared with me i used same code in the demo in this link
[primefaces demo]
https://www.primefaces.org/showcase/ui/data/diagram/flowchart.xhtml
i just copy and paste same demo code but the result is like that
[result with no connectors]
https://i.stack.imgur.com/WwIgo.png
my question what is missing to get the same result in the demo??
You've already found out that the showcase has a small pitfall builtin as it does'nt show the complete xhtml-page. A minimal empty page with the common namespaces is something like
<?xml version="1.0" encoding="UTF-8" ?>
<!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:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
</h:body>
</html>
h:head is important as Primefaces automagically injects the dependencies (stylesheets, scripts) here.
Related
I am using JSF and want to render html5 tags but they get ignored and not rendered at all into my browser.
So in the below example code, my page just shows one input box and the second one does not get rendered at all.
I'm using JSF 2.2 (Mojarra implementation javax.faces-2.2.0-m01.jar)
Any idea why such a behaviour?
My .xhtml page is:
<?xml version="1.0" encoding="UTF-8"?>
<!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://xmlns.jcp.org/jsf/html"
xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
>
<h:body>
<input type="text" placeholder="Enter your Name from HTML5 tag" />
<h:form>
<h:inputText p:placeholder="Enter your Name from JSF" />
</h:form>
</h:body>
Change !DOCTYPE declaration to just <!DOCTYPE html>.
Finally fixed it by using Mojarra 2.2.2 (you can also even use the very latest ones). ...as in 2.2.0 and 2.2.1 the XML namespaces are broken as detailed in the post Using new xmlns.jcp.org namespace on composites causes java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent
The wrong html output:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
...
The main template:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<h:head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title><h:outputText value="dmw #{title}"/></title>
<h:outputStylesheet library="#{uiSkin}" name="css/layout.css" />
<h:outputStylesheet library="standard" name="css/developer.css"
rendered="#{developMode}" />
...
</h:head>
<h:body>
Example of a included page:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<ui:composition>
...
</ui:composition>
</html>
Used Versions:
<jsf-api.version>2.1</jsf-api.version>
<jsf-impl.version>2.1.21</jsf-impl.version>
<richfaces.version>4.3.2.Final</richfaces.version>
<prettyfaces.version>3.3.3</prettyfaces.version>
<tomahawk.version>1.1.14</tomahawk.version>
When i remove all ui:include and ui:insert tags everything is fine. I build a smaller Testproject which also works like suspected. The error seems to occur when a included page is loaded. A ui:insert tag which can´t be resolved doesn´t lead to the error. I think it has something to do with the rendering configuration.
I tried a few entries in faces-config but without sucess.
The following entry removes the unwanted declaration but also the doctype.
<faces-config-extension>
<facelets-processing>
<file-extension>.xhtml</file-extension>
<process-as>xml</process-as>
</facelets-processing>
</faces-config-extension>
XML prolog / instruction not removed from XHTML output
I have no idea where it comes frome?
Does anybody have a clue?
If you use the 'xml' processing method for facelet files, the doctype is consumed during the process, alongside with the processing instructions. See the table in this answer: https://stackoverflow.com/a/10706157/801153.
To reapply the DOCTYPE tag, you can use the jsf h:doctype tag before the html. To do so you need to enclose the tags in a ui:composition tag, like this:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:doctype rootElement="html" xmlns:h="http://java.sun.com/jsf/html" />
<html lang="nl">
... page content ...
</html>
</ui:composition>
The processing instruction and the DOCTYPE in this snippet apply to the .xhtml file source content, not the generated output. These must remain if you have your sourcefiles in xhtml format.
Alternatively you could experiment with the 'html5' type, as also specified in the table in the linked answer above. This would be useful if you have or create your sourcefiles as html5 files. This is the default processing method, when nothing is specified.
This retains the doctype in a simplified version. However, this also passes any <?xml .. ?> processing instruction to the html output (your original issue). So you should then remove these processing instructions from your sourcefiles.
I'm building a simple webapp that shows a map from GoogleMaps with multiple markers loaded from my database... but I can't get it to render...
I'm using JSF 2 and gmaps4jsf.
My page looks like this:
<!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:m="http://code.google.com/p/gmaps4jsf/">
[...]
<m:map width="500px" latitude="10.1" longitude="10.1" height="500px" zoom="6" autoReshape="true">
<ui:repeat var="loc" value="#{locs}">
<m:marker latitude="#{loc.latitude}" longitude="#{loc.longitude}">
<m:htmlInformationWindow htmlText="#{loc.latitude}-#{loc.longitude}" />
</m:marker>
</ui:repeat>
</m:map>
[...]
I copied the code from an example that is supposed to work... but I can't see the map.
I have gmaps4jsf-core-3.0.0.jar on my classpath, I think I don't have to configure anything else... any ideas?
EDIT: It seems that the tags are not being recognized. When I click on "view source code" in the browser the gmaps tags are not "translated", they are being shown as I wrote them in the xhtml file.
If your tags are not being translated the most probably is that the jar file is in the wrong place. Something is avoiding your webapp to find it. How are you building it?
Place the the latest library jar in your web application WEB-INF/lib folder.
Your m:map has to be inside a h:form tag.
Due to your library version you should include a javascript code:
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=true">
</script>
Take a look at this simple example for using gmaps4jsf2 library.
Have you got it working with a very basic configuration first?
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:m="http://code.google.com/p/gmaps4jsf/">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
template="/template/base-template.xhtml">
<ui:define name="js">
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?sensor=true">
</script>
</ui:define>
<ui:define name="title">
This is the new title
</ui:define>
<ui:define name="content">
<h1>Simple Map with a marker and an InfoWindow</h1>
<h:form id="form">
<m:map width="500" height="450px" latitude="37.13" longitude="22.43" enableScrollWheelZoom="true">
<m:marker>
<m:htmlInformationWindow htmlText="This is Sparta, Greece"/>
</m:marker>
</m:map>
</h:form>
</ui:define>
</ui:composition>
</html>
Regards,
I've just started using primefaces 3.5 and I'm dealing with a weird problem.
1. editor doesn't show up on the page
2. galleria only shows the images in a list
3.popups don't work at all
4. calendar appears as a text field
does anybody know what could have caused this problem? I'm not getting any errors and other stuff like p:media work just fine.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>First JSF</title>
</head>
<p:editor></p:editor>
</html>
I think you have to add below line in your JSF page
<f:view contentType="text/html"/>
OK, Finally I solved the problem.
Just simply used <h:head> instead of <head> tag that I'd used before.
Here is the beginning of my HTML page :
1. <?xml version="1.0" encoding="utf-8" ?>
2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3. <html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
4. (...)
5. </html>
Whether there is the <?xml ... ?> part or not, Eclipse returns me a warning event on the line 3
Undefined attribute name (xmlns).
This xmlns attribute is required for correct validation, and so I don't understand why Eclipse returns a warning.
Furthermore, I'm using Eclipse Indigo 3.7.2 with the last PHP Developer Tool from the Eclipse database.
Anybody knows how to remove this warning, or find a way to skip this ?
Thanks for reading and helping.
There is bug filed for similar case here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=313859
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
<head>
<title>Title of the document</title>
</head>
<body>
<div>The content of the document.</div>
</body>
</html>
Should validated. Validates fine in Eclipse Juno and here: http://validator.w3.org.