Recently, I have had a lot of problems with the components of price lists, so I know why. I am using glassfishV3.0, and my version in the form of a perforation is 2.2.1. My problem is that I can not do p: the surface rendering dialog when I click on the table row. I do almos exactly as it does in their example: http://www.primefaces.org/showcase/ui/datatableComplex.jsf
I think my problem has something to do with some configuration, because I am also having problems with other perffaces components. Can someone give me a hand, please, and tell me what Iβm missing to be able to use components of primes like this without any problems? Here is the code:
JSF:
<!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:t="http://myfaces.apache.org/tomahawk" xmlns:p="http://primefaces.prime.com.tr/ui"> <ui:composition template="WEB-INF/templates/BasicTemplate.xhtml"> <ui:define name="resultsForm"> <h:form enctype="multipart/form-data"> <h:inputText id="search" value="" /><h:commandButton value="search"/> <p:dataTable var="garbage" value="#{resultsController.allGarbage}" dynamic="true" paginator="true" paginatorPosition="bottom" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15" selection="#{resultsController.garbage}" selectionMode="single" onRowSelectUpdate="display" onRowSelectComplete="fileDialog.show()"> <p:column sortBy="#{garbage.filename}" parser="string" filterBy="#{garbage.filename}" filterMatchMode="startsWith"> <f:facet name="header"> <h:outputText value="Filename" /> </f:facet> <h:outputText value="#{garbage.filename}" /> </p:column> <p:column filterBy="#{garbage.description}" filterMatchMode="contains"> <f:facet name="header"> <h:outputText value="Description" /> </f:facet> <h:outputText value="#{garbage.description}" /> </p:column> <p:column sortBy="#{garbage.uploadDate}" parser="string"> <f:facet name="header"> <h:outputText value="Upload date" /> </f:facet> <h:outputText value="#{garbage.uploadDate}" /> </p:column> </p:dataTable> <p:dialog header="Modal Dialog" widgetVar="fileDialog" modal="true" height="200"> <h:panelGrid id="display" columns="2" cellpadding="4"> <h:outputText value="FileName:" /> <h:outputText value="#{garbage.filename}" /> <h:outputText value="Upload date:" /> <h:outputText value="#{garbage.uploadDate}" /> <h:outputText value="Description" /> <h:outputText value="#{garbage.description}" /> </h:panelGrid> </p:dialog> </h:form> </ui:define> </ui:composition> </html>
Driven bean
@ManagedBean @ViewScoped public class ResultsController implements Serializable{ @EJB private ISearchEJB searchEJB; private Garbage garbage; public List<Garbage> getAllGarbage() { List<Garbage> tmpGarbage = new ArrayList<Garbage>(); for(Garbage g :searchEJB.findAllGarbage()) { tmpGarbage.add(g); } return tmpGarbage; } public Garbage getGarbage() { return garbage; } public void setGarbage(Garbage garbage) { this.garbage = garbage; }
JSF before is the composite page that I use inside this template
<!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"> <h:head> <title>title</title> <script type="text/javascript"> PrimeFaces.widget.Uploader.prototype._createPostParams = function() { var b = {}; b[PrimeFaces.PARTIAL_REQUEST_PARAM] = true; b[PrimeFaces.PARTIAL_PROCESS_PARAM] = this.id; b[PrimeFaces.PARTIAL_SOURCE_PARAM] = this.id; b[PrimeFaces.VIEW_STATE] = PrimeFaces.ajax.AjaxUtils.encodeViewState(); if (this.cfg.update) { b[PrimeFaces.PARTIAL_UPDATE_PARAM] = this.cfg.update } var a = PrimeFaces.getCookie("JSESSIONID"); if (this.cfg.script.indexOf("jsessionid") == -1) { paramIndex = this.cfg.script.indexOf('?'); if (paramIndex != -1) { this.cfg.script = this.cfg.script.substring(0, paramIndex) + ";jsessionid=" + a + this.cfg.script.substring(paramIndex); } else { this.cfg.script = this.cfg.script + ";jsessionid=" + a; } } b['cid'] = "#{javax.enterprise.context.conversation.id}"; return b; }; PrimeFaces.widget.Uploader.prototype.createPostParams = PrimeFaces.widget.Uploader.prototype._createPostParams; </script> <script type="text/javascript" src="/ primefaces_resource/2.1/yui/datasource/datasource-min.js"></script> <script type="text/javascript" src="/primefaces_resource/2.1/primefaces/paginator/paginator.js"></script> <script type="text/javascript" src="/primefaces_resource/2.1/yui/datatable/datatable-min.js"></script> <script type="text/javascript" src="/primefaces_resource/2.1/primefaces/datatable/datatable.js"></script> <script type="text/javascript" src="/primefaces_resource/2.1/yui/swf/swf-min.js"></script> <script type="text/javascript" src="/primefaces_resource/2.1/yui/charts/charts-min.js"></script> <script type="text/javascript" src="/primefaces_resource/2.1/primefaces/charts/charts.js"></script> </h:head> <body> <ui:insert name="resultsForm"/> </body> </html>
Web.xml configuration
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/pages/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>pages/index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>Resource Servlet</servlet-name> <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Resource Servlet</servlet-name> <url-pattern>/primefaces_resource/*</url-pattern> </servlet-mapping> <filter> <filter-name>PrimeFaces FileUpload Filter</filter-name> <filter-class>org.primefaces.webapp.filter.FileUploadFilter </filter-class> </filter> <filter-mapping> <filter-name>PrimeFaces FileUpload Filter</filter-name> <servlet-name>Faces Servlet</servlet-name> </filter-mapping>
In table i, located above the endless jobs, just the sortBy function and the p: dialog don't work. These are the messages that appear on the eclipse console when I refresh the page:
SEVERE: line 1:61 there is no viable alternative in the character ';'
I donβt understand what this means, I think I have some kind of configuration problem, not a syntax error. I will be very happy if anyone can help me fix this, please.