Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Vesa Kakriainen
Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?
7 février 2014 01:44
Réponse

Vesa Kakriainen

Rang: New Member

Publications: 7

Date d'inscription: 21 janvier 2014

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:
 1
 2el-api-2.2.jar
 3el-impl-2.2.jar
 4jsf-api-2.1.21.jar
 5jsf-impl-2.1.21.jar
 6liferay-faces-alloy-3.1.3-ga4.jar
 7liferay-faces-bridge-api-3.1.3-ga4.jar
 8liferay-faces-bridge-impl-3.1.3-ga4.jar
 9liferay-faces-util-3.1.3-ga4.jar
10primefaces-3.4.1.jar



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

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



 1
 2  <p:dataTable value="#{mysqltableBean.dataList}" ajax="false" cache="false" rowKey="#{DataRow.id}" lazy="false" rows="5" paginator="true" var="DataRow" border="1"
 3                    paginatorTemplate="{PreviousPageLink} {PageLinks} {NextPageLink}" selection="#{mysqltableBean.selectedRows}">   
 4                   
 5                                    <p:column selectionMode="multiple" style="width:2%" />
 6                                    
 7                         <p:column headerText="Name" style="width:200px"> 
 8                          <h:outputText value="#{DataRow.name}" /> 
 9                       </p:column> 
10                       <p:column headerText="Y-tunnus"> 
11                          <h:outputText value="#{DataRow.ytun}" /> 
12                       </p:column> 
13                       <p:column headerText="oid" style="width:200px"> 
14                          <h:outputText value="#{DataRow.oid}" /> 
15                       </p:column>
16         
17                      </p:dataTable>


DATAROW
1
2public class DataRow {
3    private String name;
4    private String ytun;   
5    private String oid;
6    private int    id;
7}
8   ...setters and getters



DATABEAN
  1
  2
  3import javax.faces.bean.ApplicationScoped;
  4import javax.faces.bean.ManagedBean;
  5import javax.annotation.PostConstruct;
  6import..... DataRow;
  7
  8@ApplicationScoped
  9@ManagedBean(name="mysqltableBean")
 10public class MysqlDataBean implements Serializable {
 11
 12private List<DataRow> dataList;      
 13   
 14public MysqlDataBean() {
 15}
 16
 17@PostConstruct
 18public void init() {
 19    dataList =new ArrayList<DataRow>();
 20    populateList();
 21}
 22
 23private DataRow[] selectedRows; 
 24
 25private boolean select1 = true;
 26
 27public void populateList() {
 28    PreparedStatement ps = null;
 29    Connection con = null;
 30    ResultSet rs = null;
 31    try
 32    {
 33        Class.forName("com.mysql.jdbc.Driver");
 34        con = DriverManager.getConnection("jdbc:mysql......etc);
 35        String sql = "select * from organisaatio limit 50";
 36       
 37        ps= con.prepareStatement(sql);
 38        rs= ps.executeQuery();
 39        int a = 0;
 40        while (rs.next())
 41        {
 42            a++;
 43            DataRow datarow = new DataRow();
 44            datarow.setId(a);
 45            datarow.setName(rs.getString("name"));
 46            datarow.setYtun(rs.getString("ytunnus"));
 47            datarow.setOid(rs.getString("oid"));
 48            
 49            dataList.add(datarow);
 50        }
 51       
 52    }
 53    catch(SQLException sle)
 54    {
 55        sle.printStackTrace();
 56    }       
 57    catch(Exception e)
 58    {
 59        e.printStackTrace();
 60    }
 61    finally
 62    {
 63        try
 64        {
 65            con.close();
 66            ps.close();
 67        }
 68        catch(Exception e)
 69        {
 70            e.printStackTrace();
 71        }
 72    }
 73}
 74
 75public List<DataRow> getDataList()
 76{
 77       
 78        return dataList;
 79}
 80
 81public void setDataList(List<DataRow> dataList) {
 82    this.dataList = dataList;
 83}
 84
 85public DataRow[] getSelectedRows() {
 86    return selectedRows;
 87}
 88
 89public void setSelectedRows(DataRow[] selectedRows) {
 90    this.selectedRows = selectedRows;
 91}
 92
 93public boolean isSelect1() {
 94    return select1;
 95}
 96
 97public void setSelect1(boolean select1) {
 98    this.select1 = select1;
 99}
100   
101}
Pièces jointes: faces-config.xml (1,0k), liferay-portlet.xml (0,8k), portlet.xml (1,2k), web.xml (2,2k)
Neil Griffin
RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?
10 février 2014 08:53
Réponse

Neil Griffin

LIFERAY STAFF

Rang: Liferay Legend

Publications: 2335

Date d'inscription: 26 juillet 2005

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
RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?
14 février 2014 00:12
Réponse

Vesa Kakriainen

Rang: New Member

Publications: 7

Date d'inscription: 21 janvier 2014

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.
Neil Griffin
RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?
14 février 2014 06:46
Réponse

Neil Griffin

LIFERAY STAFF

Rang: Liferay Legend

Publications: 2335

Date d'inscription: 26 juillet 2005

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.
Juan Gonzalez
RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?
14 février 2014 11:05
Réponse

Juan Gonzalez

LIFERAY STAFF

Rang: Liferay Legend

Publications: 2794

Date d'inscription: 28 octobre 2008

Publications Récentes

Hi Vesa,

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

To repeat this check better clear your browser cache.
Vesa Kakriainen
RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?
6 mars 2014 05:42
Réponse

Vesa Kakriainen

Rang: New Member

Publications: 7

Date d'inscription: 21 janvier 2014

Publications Récentes

I got it working by just adding JQUERY to my xhtml page..

<h:outputScript library="primefaces" name="jquery/jquery.js"/>
Neil Griffin
RE: Liferay Portal 6.1 CE: Primefaces 3.4.1 config problem?
6 mars 2014 07:08
Réponse

Neil Griffin

LIFERAY STAFF

Rang: Liferay Legend

Publications: 2335

Date d'inscription: 26 juillet 2005

Publications Récentes

You shouldn't need to do that if you have h:head and h:body in your Facelet view.