XML Parser Error in .xhtml file - jsf

After deploying our EAR file to Glassfish 3.1.2 Build 23, I receive this error in my Firefox browser:
XML Parsing Error: no element found Location: https://localhost:8181/TranscriptTool/welcome/index.xhtml Line Number 1, Column 1:
The EAR file deployed without any errors and works fine on another server, but this server generates the above error.
I've not been successful in finding the reason for this.
This is the index.xhtml file:
<?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">
<ui:composition template="/template/no_menu_layout.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:p="http://primefaces.org/ui"
xmlns:tt="http://jsf/transcripttool">
<ui:define name="title">
Login
</ui:define>
<ui:define name="content">
<h:form prependId="false">
<br/>
<p:panelGrid style="margin: 0 auto;">
<p:row>
<p:column><h:outputLabel for="username" value="Username:" /></p:column>
<p:column><p:inputText value="#{userLoginSession.username}"
id="username" required="true" label="username" /></p:column>
</p:row>
<p:row>
<p:column><h:outputLabel for="password" value="Password:" /></p:column>
<p:column><p:password value="#{userLoginSession.password}"
id="password" label="password" /></p:column>
</p:row>
<p:row>
<p:column colspan="2" style="text-align: center;"><p:commandButton id="loginButton" value="Login"
action="#{userLoginSession.login}" ajax="false"/></p:column>
</p:row>
</p:panelGrid>
<div class="ui-widget" style="text-align: center;">
<h:link outcome="passwordReset" value="Reset Password"/>
</div>
</h:form>
<div style="position: absolute;width: 100%;bottom: 70px;">
</div>
<tt:errPopup id="userError" isModal="true"
errorHandle="#{userLoginSession.errorMessages}" />
</ui:define>
</ui:composition>
Thanks Avis

We fixed the error by copying the whole GLASSFISH directory over from the one server that worked to the one that didn't. Naturally had to change a few entries in the domain.xml file but after doing this, the application now runs properly.

I will suggest you examine the template page referenced in the index.xhtml "template="/template/no_menu_layout.xhtml" as this index.xhtml seems ok. Also check to be sure all tags are properly closed in custom components referenced at xmlns:tt="http://jsf/transcripttool".

Related

Some UI parts do not respond

Some, but not all UI Components are not responding.
Restart, rebuild code and clean caches.
Part of the template file
<!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.org/ui">
<h:head>
<title><ui:insert name="title">JKPGBooking /.::.\ Boka online på ED</ui:insert></title>
</h:head>
<h:body>
<h:panelGrid columns="3">
<ui:insert name="menu">
<ui:include
src="/WEB-INF/template/header_#{userbean.currUser.role}.xhtml"></ui:include>
</ui:insert>
<p:spacer style="width: 100px; height: 10px;"></p:spacer>
<ui:insert name="content_row1_col2" />
</h:panelGrid>
<ui:insert name="content_row2_col1">
</ui:insert>
<ui:insert name="footer">
<ui:include src="/WEB-INF/template/footer.xhtml"></ui:include>
</ui:insert>
</h:body>
</html>
part of the .xhtml
<ui:define name="content_row1_col2">
<h:form>
<p:growl id="growl" showDetail="true" sticky="false" />
<br />
<br />
<p:panelGrid columns="5" id="userform">
<f:facet name="header">
<p:outputLabel value="Vem har bokat salen?" />
</f:facet>
<h:outputText value="vecka" />
<p:selectOneMenu value="#{infobean.week}" autoWidth="true" >
<f:selectItems value="#{infobean.allWeeks}" >
</f:selectItems>
</p:selectOneMenu>
<h:outputText value="Dag" />
<p:selectOneMenu value="#{infobean.day}">
<f:selectItems value="#{infobean.days}">
</f:selectItems>
</p:selectOneMenu>
<h:commandButton value="Sök"
action="#{infobean.getHouseSchedule}" update="resultTab">
</h:commandButton>
</p:panelGrid>
</h:form>
</ui:define>
Everything renders nicely but in this case only the button of the form is responding will says is fired. If I enlarge the page in the browser by changing the zoom the SelectOneMenu for the day is responding too, but never the the SelectOneMenu for the week. If I remove the panelGrid the form works as intended.
this is one example of the problem. On another page are tabs generatered by a script, in most cases 12-14. Often the last two or three are not responding/firing and there is no mouseover/hiver response. What really fiddles me is that is not always the case.

p:growl not working

My growl doesn't work, I tried like eveyrthing I found so I'm asking here how to make my growl work. My xhtml is really simple registration and login enclosed with ui:include . I'm using PrimeFaces 6.0. It is definitely different from proposed answer since answers from that doesn't work.
<?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:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<f:view>
<h:body>
<h:form>
<p:growl id="growl" showDetail="true" sticky="true" />
<h:inputText id="Email" validatorMessage="Niepoprawny format maila" value="#{userMB.tmp.email}"
label = "Email"/>
<h:messages for="Email" style="color:red;margin:8px;" />
<br/>
<h:inputText id="firstName" validatorMessage="Pole nie moze byc puste"
value="#{userMB.tmp.firstName}">FirstName</h:inputText>
<h:messages for="firstName" style="color:red;margin:8px;" /><br/>
<h:inputText id="lastName" validatorMessage="Pole nie moze byc puste"
value="#{userMB.tmp.lastName}">LastName</h:inputText>
<h:messages for="lastName" style="color:red;margin:8px;" /><br/>
<h:inputSecret id="password" validatorMessage="Pole nie moze byc puste"
value="#{userMB.tmp.password}">Password</h:inputSecret>
<h:messages for="password" style="color:red;margin:8px;" /><br/>
<p:commandButton update="growl" actionListener="#{userMB.Register()}"
icon="ui-icon-check">Register</p:commandButton>
</h:form>
<h:panelGroup>
<ui:include src="login.xhtml" />
</h:panelGroup>
</h:body>
</f:view>
</html>
I'm using this to call my growl in userMB.Register()
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Success", "Login success"));
I'm just learning JSF so please be patient with me.

JSF ui:insert with f:attribute to change attribute of a p:commandButton

I've got a project with JSF 2.1.28 and PrimeFaces 4.0. I've got a problem with my editor controller template.
My page is this:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<p:panel header="#{locCommon.report} #{locCommon.editor}">
<h:form id="editForm">
<h:panelGrid columns="2">
<p:outputLabel value="#{locCommon.name}" />
<p:inputText value="#{reportBean.businessItem.name}" />
<p:outputLabel value="HQL" />
<p:selectBooleanCheckbox value="#{reportBean.businessItem.hql}" />
<p:outputLabel value="SQL" />
<p:inputTextarea value="#{reportBean.businessItem.sql}" />
</h:panelGrid>
<p:commandButton value="#{locCommon.tryQuery}" action="#{reportBean.tryQuery()}" process="#form"
update=":resultPanel" styleClass="button" />
</h:form>
</p:panel>
<p:panel id="resultPanel" header="#{locCommon.result}">
<ui:decorate template="/components/reportTable.xhtml">
<ui:param name="lstValues" value="#{reportBean.businessItem.lstResult}" />
<ui:param name="model" value="#{reportBean.businessItem.lstReportFields}" />
</ui:decorate>
</p:panel>
<p:panel>
<h:form>
<ui:decorate template="/components/editorController.xhtml" >
<ui:param name="bean" value="#{reportBean}" />
<ui:define name="saveButtonAttributes">
<f:attribute name="process" value=":editForm"/>
</ui:define>
</ui:decorate>
</h:form>
</p:panel>
</ui:composition>
On the last panel, there is an another template, which I want to set process attribute of a commandButton on this template:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<table style="width: 100%;">
<tr>
<td align="left">
<p:commandButton value="#{locCommon.save}" styleClass="button" action="#{bean.save(true)}" process="#form">
<ui:insert name="saveButtonAttributes"/>
</p:commandButton>
</td>
<td align="right">
<p:commandButton value="#{locCommon.cancel}" styleClass="button" action="#{bean.cancel()}" process="#this" />
</td>
</tr>
</table>
</ui:composition>
The code above sadly not set this process attribute to ':editForm' which is the goal. My question is, how can I do this?

No navigation happens when using a p:commandButton

Here is a Facelets file which is used to get first and last name and after that will go to the another Facelets file:
<?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://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head><title>User Form</title></h:head>
<h:body>
<h:form>
<h:panelGrid columns="2">
<p:graphicImage value="resources/images/image.jpg" width="50%"/>
<p:panelGrid columns="2" width="50%">
<f:facet name="header">
User Form
</f:facet>
<h:outputLabel for="firstname" value="Firstname: *"/>
<p:inputText id="firstname" value="" label="Firstname"/>
<h:outputLabel for="surname" value="Surname: *"/>
<p:inputText id="surname" value="" required="true" label="Surname"/>
<f:facet name="footer">
<p:commandButton type="button" value="Save" icon="ui-icon-check" style="margin:0" action="construction"/>
</f:facet>
</p:panelGrid>
</h:panelGrid>
</h:form>
</h:body>
</html>
I expected to go to the construction.xhtml when I press the "Save" button, but nothing happens. How is this caused and how can I solve it?
when you are using commandButton you must do something like this:
<p:commandButton value="Save" icon="ui-icon-check" style="margin:0" action="#{someBean.navigate}"/>
it means that you must use managed bean
and in your case you must use button instead of commandButton

The Prime Faces out put is not ideal out put

i want to use prime faces to create a panel and my .xhtml 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://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:body>
<p:panelGrid columns="2">
<f:facet name="header">
Basic PanelGrid
</f:facet>
<h:outputLabel for="firstname" value="Firstname: *"/>
<p:inputText id="firstname" value="" label="Firstname"/>
<h:outputLabel for="surname" value="Surname: *"/>
<p:inputText id="surname" value="" required="true" label="Surname"/>
<f:facet name="footer">
<p:commandButton type="button" value="Save" icon="ui-icon-check" style="margin:0"/>
</f:facet>
</p:panelGrid>
</h:body>
</html>
the result is :
but the desired output is :
what this problem caused and how can i resolve it?
In order to themes work you'll need to add that to your project. Since you're using normal project(non maven). Download the all-themes jars from here
Add that jar to your build path and try running again.

Resources