Forums de discussion

Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?

Vesa Kakriainen, modifié il y a 10 années.

Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?

New Member Publications: 7 Date d'inscription: 21/01/14 Publications récentes
I did get the Datatable pager working in my project when changing from (primefaces 3.5.jar) to (primefaces 3.4.1.jar), but however if I add checkbox into my dataTable.. table wont change the page any more. Neither I cant tick
the checkbox to active. I added my dataTable -code here and mysqldatabean. Can someone help me with this:

If I just add the checkbox into my .xhtml page, I still cant change it's state

I still have multipse Liferay portal 6.1 portlets and it seems difficult to migrate into Liferay portal 6.2 CE. I think the problem is that
i have wrong libraries or I need to add some extra configuration to get primefaces work properly.

I have these libraries in the Eclipse project:

el-api-2.2.jar
el-impl-2.2.jar
jsf-api-2.1.21.jar
jsf-impl-2.1.21.jar
liferay-faces-alloy-3.1.3-ga4.jar
liferay-faces-bridge-api-3.1.3-ga4.jar
liferay-faces-bridge-impl-3.1.3-ga4.jar
liferay-faces-util-3.1.3-ga4.jar
primefaces-3.4.1.jar



I just want similiar function like here in example: http://www.primefaces.org/showcase/ui/datatableRowSelectionRadioCheckbox.jsf

checkbox

 <f:column selectionMode="multiple" style="width:2%" />




  <p:datatable value="#{mysqltableBean.dataList}" ajax="false" cache="false" rowkey="#{DataRow.id}" lazy="false" rows="5" paginator="true" var="DataRow" border="1" paginatortemplate="{PreviousPageLink} {PageLinks} {NextPageLink}" selection="#{mysqltableBean.selectedRows}">	
				    
                                    <p:column selectionMode="multiple" style="width:2%" />
				     			   
			  		   <p:column headertext="Name" style="width:200px">  
				          <h:outputtext value="#{DataRow.name}" />  
				       </p:column>  
				       <p:column headertext="Y-tunnus">  
				          <h:outputtext value="#{DataRow.ytun}" />  
				       </p:column>  
				       <p:column headertext="oid" style="width:200px">  
				          <h:outputtext value="#{DataRow.oid}" />  
				       </p:column>
         
  					</p:datatable>


DATAROW
 
public class DataRow {
	private String name;
	private String ytun;	
	private String oid;
	private int    id;
}
   ...setters and getters




DATABEAN


import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.annotation.PostConstruct;
import..... DataRow;

@ApplicationScoped
@ManagedBean(name="mysqltableBean")
public class MysqlDataBean implements Serializable {

private List<datarow> dataList;  	
	
public MysqlDataBean() {
}

@PostConstruct 
public void init() {
	dataList =new ArrayList<datarow>();
	populateList();
}

private DataRow[] selectedRows;  

private boolean select1 = true;

public void populateList() {
	PreparedStatement ps = null;
	Connection con = null;
	ResultSet rs = null;
	try
	{
		Class.forName("com.mysql.jdbc.Driver");
		con = DriverManager.getConnection("jdbc:mysql......etc);
		String sql = "select * from organisaatio limit 50";
		
		ps= con.prepareStatement(sql); 
		rs= ps.executeQuery(); 
		int a = 0;
		while (rs.next())
		{
			a++;
			DataRow datarow = new DataRow();
			datarow.setId(a);
			datarow.setName(rs.getString("name"));
			datarow.setYtun(rs.getString("ytunnus"));
			datarow.setOid(rs.getString("oid"));
			
			dataList.add(datarow);
		} 
		
	}
	catch(SQLException sle)
	{
		sle.printStackTrace();
	}		
	catch(Exception e)
	{
		e.printStackTrace();
	}
	finally
	{
		try
		{
			con.close();
			ps.close();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}

public List<datarow> getDataList()
{
	    
		return dataList;
}

public void setDataList(List<datarow> dataList) {
	this.dataList = dataList;
}

public DataRow[] getSelectedRows() {
	return selectedRows;
}

public void setSelectedRows(DataRow[] selectedRows) {
	this.selectedRows = selectedRows;
}

public boolean isSelect1() {
	return select1;
}

public void setSelect1(boolean select1) {
	this.select1 = select1;
}
	
}

</datarow></datarow></datarow></datarow>
thumbnail
Neil Griffin, modifié il y a 10 années.

Moved to Liferay Faces - English sub-category.

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Moved to Liferay Faces - English sub-category.
thumbnail
Neil Griffin, modifié il y a 10 années.

RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Regarding your Liferay 6.1 configuration, all the jar versions look good except for el-impl-2.2.jar -- try running without that. With the Liferay Faces demo portlets, we use the old jboss-el.jar dependency since it makes EL work consistently with old servers that don't have the Unified EL. For more info, see jsf2-portlet/pom.xml and jsf2-portlet/src/main/webapp/WEB-INF/web.xml

Regarding Liferay 6.2, you would need version 3.2.4-ga5 which we are hoping to release this week. For now you can use 3.2.4-ga5-SNAPSHOT jars from the Snapshot Repository. For more info, see the Liferay Faces Version Scheme.
Vesa Kakriainen, modifié il y a 10 années.

RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?

New Member Publications: 7 Date d'inscription: 21/01/14 Publications récentes
Thank you Neil for the quick response.
I think this problem has something to do with javascript or ajax.
I get these errors in Chrome console when executing the xhtml page.



I also changed my JSF Jars to jsf-api-2.1.3-b02.jar jsf-impl-2.1.3-b02.jar along the jboss-el-2.0.0.GA.jar

Still same situation. Cannot tick checkboxes.
thumbnail
Neil Griffin, modifié il y a 10 années.

RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
I would recommend that you go back to Mojarra 2.1.21 since that is the version we are currently testing Liferay Faces with and it is working well.

Regarding the JS problem, I would recommend that you deploy a JSF webapp to plain Tomcat (not a portlet in Liferay+Tomcat) and see if the same problem occurs.
Vesa Kakriainen, modifié il y a 10 années.

RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?

New Member Publications: 7 Date d'inscription: 21/01/14 Publications récentes
I got it working by just adding JQUERY to my xhtml page..

<h:outputScript library="primefaces" name="jquery/jquery.js"/>
thumbnail
Neil Griffin, modifié il y a 10 années.

RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
You shouldn't need to do that if you have h:head and h:body in your Facelet view.
thumbnail
Juan Gonzalez, modifié il y a 10 années.

RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?

Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
Hi Vesa,

are you having any "404" error in your "Network" tab?

To repeat this check better clear your browser cache.