Problems with Primefaces editor calendar galleria etc - primefaces

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.

Related

remove unwanted tags from html using python rgex

i'm a beginner in python. i need a quick help for you all. here is my scenario. i am having number of html files in a folder. i need to remove some unwanted tags from those html files. can you give a best and optimized way to remove those tags in all my files(file range around 500). i user regular expression to remove those tags .
This is my sample html:
<?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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="willing pop" content="Sent for Review" />
<meta name="generator" content="Adobe RoboHelp 2015" />
<title>System Access</title>
<link rel="StyleSheet" href="..\..\..\default.css" type="text/css" />
</head>
<body>no text found</body>
in the above html i want "no text found" alone.
My try but it is not working (python 3):
import re
with open(r"E:\python\testfiles\sample.html")as opn:
k=opn.read()
v=re.sub(r"<\?xml.* .* *.>","",k,re.I|re.M)
print(v)
thanks in advance for your help.

Why connectors in primefaces flowchart componant not appeared?

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.

Removing <body> with a userscript

I'm sorry, but I am not very good with programming. I am trying to fix this irritating bug on my school's website through a userscript. I have tested the RegEx on several pages, at least that works. I need to make the userscript remove the parts I don't want to see. This is a snippet from the source of the website, I have marked what needs to be removed with '//'.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
//<html><head>
//<title>404 Not Found</title>
//</head><body>
//<h1>Not Found</h1>
//<p>The requested URL /get.php was not found on this server.</p>
//</body></html>
<!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" xml:lang="en-gb" lang="en-gb" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
This is my userscript that does not work. I know it reflects my skills as a programmer, please don't hate.
var REGEX = /<HTML>(.*?)([^\n]*?\n+?)+?<\/BODY><\/HTML>/ig;
document.body.innerHTML=document.body.innerHTML.replace(REGEX, '');
This markup is obviously invalid, but the browser (at least Chrome and Firefox) will merge these two <html> sections together with its best guess. So interacting with document.body is probably not what you want.
Doing something like this will visually fix the issue:
document.querySelector('h1').remove() // remove first h1 "Not Found"
document.querySelector('p').remove() // remove first p "The requested..."

JSF 2 remove xml declaration in rendered output

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.

unicode gibberish character in html

I am trying to rewrite old php mysql website in codeigniter, The site is in unicode, and text in database is stored like this
बेलायतम&.
when i pull data from database and display in html it appears like this
सरà¥à¤µà¥‹à¤šà¥à¤šà¤•à¥‹ à
It is fine in old site, I am using exactly as same header as old site in html
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I am banging my head how to correct text ?
Try this
<meta charset='utf-8'>
There should be a problem, html's codes you are using are right, just in case check if you can see proper characters on this website:
http://www.unicodeblocks.com/block/Devanagari
and make sure you are using:
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Please double check it - use "view page source" on your page and check, maybe you used meta tag twice with different variables?
and one more...
if you are using db, please do this:
$mysqli->query('set character set utf8');