p:poll in mobile PF not working

UI Components for JSF
Post Reply
michal123
Posts: 5
Joined: 28 Sep 2014, 22:27

07 Oct 2014, 16:06

Hi,

I want to use <p:poll> in my mobile web application, but it's not working. In Glassfish log I can see these warnings:

Warning: JSF1064: Unable to find or serve resource, undefined/undefined.css, from library, primefaces.
Warning: JSF1064: Unable to find or serve resource, undefined/undefined.js, from library, primefaces.

When I turn off the mobile render kit, p:poll works and in gf log are not any warnings. How can I use poll in mobile PF?

My env: PF 5.1 (tried also 5.0), Mojarra 2.2.7, GF 3.1.2.2, Java 7.

Thank you

Michal

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

07 Oct 2014, 17:58

you may need to use h:outputScript to include primefaces.js or the appropriate primefaces 'poll.js' file. i think i had to do that for 'all' my PrimeFaces Mobile page, just to make sure primefaces.js page is downloaded to the client/browser.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

michal123
Posts: 5
Joined: 28 Sep 2014, 22:27

07 Oct 2014, 19:18

Hi,

thank you, adding <h:outputScript library="primefaces/poll" name="poll.js"/> did the trick :)

Michal

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

07 Oct 2014, 19:32

michal123 wrote:adding

Code: Select all

<h:outputScript library="primefaces/poll" name="poll.js"/>
did the trick :)
glad to hear that, thanks for sharing the code.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

FkJ
Posts: 183
Joined: 08 Jan 2010, 19:16

30 Jul 2015, 15:12

michal123 wrote:Hi,

thank you, adding <h:outputScript library="primefaces/poll" name="poll.js"/> did the trick :)

Michal

I tried this approach with 5.1.20 and 5.2.9, no success. I get this message:

Code: Select all

ADVERTÊNCIA: Resource referenced by resourceName poll.js and libraryName primefaces/poll not found in call to ResourceHandler.createResource. It will be silenty ignored.
In fact I checked the rendered html of a regular PrimeFaces page that uses poll and I didn't found any poll.js reference.

Any ideas?

Thanks

FkJ
Posts: 183
Joined: 08 Jan 2010, 19:16

30 Jul 2015, 16:04

Solved:

Code: Select all

<h:outputScript library="primefaces"	name="primefaces.js" />
Last edited by FkJ on 09 Sep 2015, 18:59, edited 1 time in total.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

04 Sep 2015, 10:28

This is weird... Should not be needed. I use Poll to in a mobile webapp and it works. Do you have any other PF tags on that page?

FkJ
Posts: 183
Joined: 08 Jan 2010, 19:16

09 Sep 2015, 19:21

Yes, but they are rendered inside a c:forEach.

Also, select one menu rendered inside this forEach don't get styled. Tried to import primefaces.css, but no success. Other components like radio buttons and command buttons render fine.

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

09 Sep 2015, 19:33

FkJ wrote:Also, select one menu rendered inside this forEach don't get styled. Tried to import primefaces.css, but no success.
what's wrong with the PrimeFaces (jQuery) Mobile renderer for p:selectOneMenu?

The selectOneMenu component on the Forms page of the PrimeFaces Mobile showcase looks good to me. I don't think you will be able to 'render' the HTML_BASIC version of p:selectOneMenu when you select the PRIMEFACES_MOBILE render kit for your page that contains p:selectOneMenu.

Right? :geek:
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

FkJ
Posts: 183
Joined: 08 Jan 2010, 19:16

10 Sep 2015, 16:29

kukeltje wrote:This is weird... Should not be needed. I use Poll to in a mobile webapp and it works. Do you have any other PF tags on that page?
I tested in a page without c:forEach and I still had to add primefaces.js to make p:poll work. Tested with PF 5.1.21 and 5.2.11.

Without primefaces.js I see this on Chrome's console:

https://www.dropbox.com/s/49abqxnn3vw99id/poll.png

Code: Select all

GET http://localhost:8080/colaborador/javax.faces.resource/undefined/undefined.css.jsf?ln=primefaces&v=5.1.21 (anonymous function) @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bI.fn.extend.domManip @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bI.fn.extend.append @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25b.createWidget @ primefaces-mobile.js.jsf?ln=primefaces&v=5.1.21:1b.cw @ primefaces-mobile.js.jsf?ln=primefaces&v=5.1.21:1(anonymous function) @ inicio.jsf:5bI.Callbacks.i @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bI.Callbacks.cd.fireWith @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bI.extend.ready @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bZ @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25
VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25GET http://localhost:8080/colaborador/javax.faces.resource/undefined/undefined.js.jsf?ln=primefaces&v=5.1.21 404 (Not Found)bI.ajaxTransport.e.send @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bI.extend.ajax @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25b.getScript @ primefaces-mobile.js.jsf?ln=primefaces&v=5.1.21:1b.createWidget @ primefaces-mobile.js.jsf?ln=primefaces&v=5.1.21:1b.cw @ primefaces-mobile.js.jsf?ln=primefaces&v=5.1.21:1(anonymous function) @ inicio.jsf:5bI.Callbacks.i @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bI.Callbacks.cd.fireWith @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bI.extend.ready @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25bZ @ VM73 jquery.js.jsf?ln=primefaces&v=5.1.21:25
page code:

Code: Select all

<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pm="http://primefaces.org/mobile"
	template="template.xhtml"
>
	<ui:define name="page">
		<pm:page id="inscricaoView">
			<h:form>
				<p:poll
					interval="5"
					listener="#{avaliacaoController.checkMinutosRestantes()}"
					ignoreAutoUpdate="true"
					process="@this"
					global="false"
					update="@(.ui-btn-right)"
					widgetVar="pollProva"
				/>

				<pm:header
					title="#{avaliacaoController.tituloApp}"
					swatch="b"
				/>
				<pm:content>
					<p:messages autoUpdate="true" />

					<p:focus
						id="focus"
						for="senha"
					/>

					<pm:field>
						<p:outputLabel
							for="senha"
							value="Senha: "
						/>
						<p:password
							id="senha"
							value="#{avaliacaoController.senha}"
							required="true"
							label="Senha: "
						/>
					</pm:field>
				</pm:content>
				<pm:footer swatch="b">
					<center>
						<p:commandButton
							value="Enviar"
							icon="ui-icon-check"
							update="focus, :provasView:provaForm"
							action="#{avaliacaoController.findInscricao()}"
						/>
					</center>
				</pm:footer>
			</h:form>
		</pm:page>

		<pm:page id="provasView">
			<pm:header
				title="#{avaliacaoController.tituloApp}"
				swatch="b"
			/>
			<pm:content>
				<h:form id="provaForm">
					<p:messages autoUpdate="true" />

					<h4>Inscrito: #{avaliacaoController.inscricao.nome}</h4>

					<p:separator />

					<h4>#{avaliacaoController.avaliacoesDisponiveisTitle}</h4>

					<p:dataList
						id="provas"
						value="#{avaliacaoController.provas}"
						var="prova"
					>
						<p:commandLink
							action="#{avaliacaoController.createPerguntaList(prova)}"
							value="#{prova.assunto}"
							process="@this"
							onclick="if (! window.confirm('Confirma o início da avaliação #{prova.assunto}?\n\nVocê terá #{prova.duracao} minutos.') ) {return false}"
						/>
					</p:dataList>
				</h:form>
			</pm:content>
		</pm:page>
	</ui:define>
</ui:composition>
template.xhtml

Code: Select all

<!DOCTYPE html>
<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:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:pm="http://primefaces.org/mobile"
>
<f:view renderKitId="PRIMEFACES_MOBILE" />

<h:head>
	<title>#{avaliacaoController.tituloApp}</title>

	<link
		rel="shortcut icon"
		href="#{resource['image/favicon.ico']}"
	/>
</h:head>
<h:body>
	<ui:insert name="events" />

	<ui:insert name="page" />
</h:body>
</html>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 31 guests