I just tried to just copy-paste sample from PrimeFaces Showcase about Barcode.
Here is this code, and I get:
I just wanted to test it go get same effect as sample.
<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:pm="http://primefaces.org/mobile"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<p:panelGrid columns="2">
<h:outputText value="Postnet" />
<p:barcode value="0123456789" type="postnet"/>
<h:outputText value="QR" />
<p:barcode value="0123456789" type="qr"/>
</p:panelGrid>
</h:body>
Have you add barcode4j and qrgen library into your dependency?
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j-light</artifactId>
<version>2.1</version>
</dependency>
**barcode4j 2.1 does not exist in maven central repository so manual installation is necessary for
maven users
you need to add a jar file to your repository to let primefaces understand the component much better. You can get the jar from here http://www.barcodelib.com/java_barcode/barcode_symbologies. That is the "barcode4j-light version 2.1"
Related
I have a problem that I can't fix for a very long time. I can't use icefaces sliderEntry in my project, I do this:
pom:
<repository>
<id>snapshots</id>
<url>http://anonsvn.icefaces.org/repo/maven2/releases/</url>
</repository>
and more:
<dependency>
<scope>provided</scope>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-ace</artifactId>
<version>3.1.0</version>
</dependency>
in my xhtml:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
xmlns:ace="http://www.icefaces.org/icefaces/components"
>
so I call the slider:
<h:form>
<ace:sliderEntry />
</h:form>
But I don't see it on my page, the debugging tools also don't say anything useful. Maybe I ported something wrong?
UPD
I noticed that this element in the browser has the hidden type, why is this happening?
Use
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-ace</artifactId>
<version>4.3.0</version>
</dependency>
and be sure that all the icefaces libraries have a "compile" scope
You need also use <h:body> instead of default <body> tags
I work with PrimeFaces 5.2.
These are my maven dependencies:
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
</dependency>
</dependencies>
I have the XHTML:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
<h:head />
<h:body>
<h:outputLabel>Name:</h:outputLabel>
<h:form>
<p:spinner />
</h:form>
</h:body>
</f:view>
</html>
The output screen is
How do I have to configure my project to see the spinner?
I think you should read the documentation for a spinner in Primefaces. Spinner is primarily used to increment/decrement the value of input text. You also need to create a bean defining the setter/getter for the values.
Do have a look https://www.primefaces.org/showcase/ui/input/spinner.xhtml
Just for reference:
<h:outputLabel for="basic" value="Basic Spinner: " />
<p:spinner id="basic" value="#{spinnerView.number1}" />
Hope it helps!!
I am a JSF beginner. I try to implement ICEfaces 3.0 component in Eclipse 4.2 (Juno). I had implemented & run it using Apache Tomcat 7.0. It showing the following error in window:
Cannot add the same component twice
In console bar it shows as :
javax.faces.FacesException: Cannot add the same component twice: v8z4ho2-retrieve-update
My JSF Code
<?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://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:icecore="http://www.icefaces.org/icefaces/core"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:ice="http://www.icesoft.com/icefaces/component" >
<h:head>
<title>Chart</title>
<link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css"/>
</h:head>
<h:body styleClass="ice-skin-rime">
<h:form id="canvasForm">
<ace:chart id="chart" animated="false" value="#{chartBean.barData}"
stackSeries="false" defaultAxesConfig="#{chartBean.barDemoDefaultAxis}"
xAxis="#{chartBean.barDemoXAxis}" yAxis="#{chartBean.barDemoYAxis}"
legend="true" legendPlacement="OUTSIDE_GRID" highlighter="true"
highlighterLocation="N" highlighterShowMarker="false"
highlighterBringSeriesToFront="true"
widgetVar="barChart" />
</h:form>
</h:body>
</html>
How to rectify this error? Help me out.
In ICEFaces forum I've found many people with this problem. If you are using Tomcat 7.0.42, try Tomcat 7.0.41 instead and see if it works. Also check if you have icefaces jar duplicated (or icefaces.jar and icefaces-ee.jar) in the same classpath. The link to the post is:
http://www.icesoft.org/JForum/posts/list/22121.page#sthash.qxEkXX1Q.dpbs
Fixed by reverting icefaces version from 3.3.0 to 3.0.1:
<!-- Ices Dependencies -->
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-ace</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-compat</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.icepush</groupId>
<artifactId>icepush</artifactId>
<version>3.1.0</version>
</dependency>
I'm learing RichFaces now for my JSF project, but i have problem with rendering rich components in my enviroment.
I have added RichFaces jar(all 4 jars from RichFaces page) to JBoss modules (E:\JBoss\modules\org\richfaces\main) with module.xml:
<module xmlns="urn:jboss:module:1.1" name="org.richfaces">
<resources>
<resource-root path="richfaces-components-api-4.2.1.Final.jar"/>
<resource-root path="richfaces-components-ui-4.2.1.Final.jar"/>
<resource-root path="richfaces-core-api-4.2.1.Final.jar"/>
<resource-root path="richfaces-core-impl-4.2.1.Final.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="org.w3c.css.sac"/>
<module name="net.sourceforge.cssparser"/>
<module name="com.sun.jsf-impl"/>
<module name="javax.api"/>
<module name="javax.faces.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.xml.jaxp-provider"/>
<module name="com.google.guava"/>
</dependencies>
</module>
All dependencies were added to jboss modules by default configuration.
I created simple JSF page with RichFaces from tutorial:
<!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:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<h:head></h:head>
<body>
<rich:panel>
<f:facet name="header">
Write your own custom rich components with built-in AJAX support
</f:facet>
<h:outputText value="Panel Body" />
</rich:panel>
<rich:panel>
<f:facet name="header">
Write your own custom rich components with built-in AJAX support
</f:facet>
<h:outputText value="Panel Body" />
<a4j:form>
<h:outputText value="The integer version of the selected color:" />
<h:outputText id="RGBvalue" value="#{colorPickerBean.color}" />
<rich:panel header="RichFaces Color Picker" style="width: 315px">
<rich:colorPicker value="#{colorPickerBean.color}" colorMode="rgb"
converter="org.richfaces.IntegerColor">
<a4j:support event="onchange" reRender="RGBvalue" />
</rich:colorPicker>
</rich:panel>
</a4j:form>
</rich:panel>
</body>
</html>
Both xmlns in head tag are highlighted with "NLS missing message: CANNOT_FIND_FACELET_TAGLIB in: org.eclipse.jst.jsf.core.validation.internal.facelet.messages"
I've deployed my new xhtml page for JBoss and now rich components aren't handled proper. Next listing shows source of deployed page.
<!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:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"><head></head>
<body>
<rich:panel>Panel Body
</rich:panel>
<rich:panel>Panel Body
<a4j:form>The integer version of the selected color:<span id="RGBvalue"></span>
<rich:panel header="RichFaces Color Picker" style="width: 315px">
<rich:colorPicker colorMode="rgb" converter="org.richfaces.IntegerColor">
<a4j:support event="onchange" reRender="RGBvalue"></a4j:support>
</rich:colorPicker>
</rich:panel>
</a4j:form>
</rich:panel>
</body>
</html>
My jboss-deployment-structure.xml in WebContent/META-INF:
<jboss-deployment-structure>
<sub-deployment name="Tutorial2.war">
<dependencies>
<module name="org.richfaces" slot="main">
<imports>
<include path="**" />
</imports>
</module>
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Modules defines as showed in link https://issues.jboss.org/browse/RF-12008
After few more changes I got
00:29:52,455 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."Tutorial2.war".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."Tutorial2.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "Tutorial2.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_31]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_31]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Sub deployment Tutorial2.war in jboss-structure.xml was not found. Available sub deployments:
at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.subDeploymentNotFound(DeploymentStructureDescriptorParser.java:233) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:159) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Error occurs as soon as I add jboss-deployment-structure.xml to WEB-INF.
This looks like it's probably an issue with eclipse. It seems there are a few different questions along the same lines with eclipse and JSF. Most of them seem to say something this one does.
see following discussion on jboss forum
https://community.jboss.org/message/633025#633025
and search for the correnct answer
you should supply jboss7 specific deployment descriptor jboss_deployment_structure.xml to make richfaces module available to your application
I just added PrimeFaces 3.0 to a JSF project:
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.0</version>
</dependency>
And I created this test page:
<!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:p="http://primefaces.prime.com.tr/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</h:head>
<h:body>
<h:form>
<p:panel header="F.C. Barcelona" footer="Visca el Barca!">
<h:outputText value="FC Barcelona " />
</p:panel>
<h:outputText id="name" value="#{facesBean.name}" /> <h:commandButton value="Submit" action="#{facesBean.callService()}" />
</h:form>
</h:body>
</html>
But the <p:panel> component is not rendered. Only the <h:xxx> components are properly rendered.
I have PrimeFaces jar in Maven dependecies and in the target folder. I'm using Tomcat 7. PrimeFaces doesn't need any additional configuration, right?
xmlns:p="http://primefaces.prime.com.tr/ui"
This XML namespace is for PrimeFaces 2.x only. Since PrimeFaces 3.0, the new XML namespace is
xmlns:p="http://primefaces.org/ui"
Make sure that you're reading documentation/tutorials concerning PrimeFaces 3.0, not 2.x.