Passage de parametre entre un beam est jsf
anisj1m
-
anisj1m -
anisj1m -
Bonjour,
j'ai un probleme de passage de parametre de type list entre on bean et ma jsf;
mon bean est
[code]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.trinidad.imaf;
import javax.faces.context.FacesContext;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;
import com.labosun.cj.ejb3.entity.Contact;
import com.labosun.cj.ejb3.session.ContactManager;
import com.labosun.cj.web.locator.EjbLocator;
import java.util.List;
/**
* A typical simple backing bean, that is backed to
*
*/
public class Beanlist
{
//properties
private String firstname;
private String lastname;
private String address;
private int zipCode;
private String city;
private String phone;
private String mobile;
private List<Contact> Listcontact;
/**
* default empty constructor
*/
public Beanlist()
{
}
//-------------------getter & setter
//debut
public String getfirstname()
{
//firstname = "anis";
return firstname;
}
public void setfirstname(String name)
{
this.firstname = name;
}
//fin
//debut
public String getlastname()
{
return lastname;
}
public void setlastname(String name)
{
this.lastname = name;
}
//fin
//debut
public String getaddress()
{
return address;
}
public void setaddress(String name)
{
this.address = name;
}
//fin
//debut
public int getzipCode()
{
return zipCode;
}
public void setzipCode(int name)
{
this.zipCode = name;
}
//fin
//debut
public String getcity()
{
return city;
}
public void setcity(String name)
{
this.city = name;
}
//fin
//debut
public String getphone()
{
return phone;
}
public void setphone(String name)
{
this.phone = name;
}
//fin
//debut
public String getmobile()
{
return mobile;
}
public void setmobile(String name)
{
this.mobile = name;
}
//fin
public List<Contact> getListcontact()
{
ContactManager contactManager = EjbLocator.getLocator().getContactManager();
Listcontact = contactManager.getlistContact();
System.out.println(Listcontact.toString());
return Listcontact;
}
}
[/code]
et ma jsf est :
[code]
<tr:table value="#{Beanlist.Listcontact}" var="entry">
<tr:column>
<tr:outputText value="entry.firstname"></tr:outputText>
</tr:column>
</tr:table>
[/code]
j'ai un probleme de passage de parametre de type list entre on bean et ma jsf;
mon bean est
[code]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.trinidad.imaf;
import javax.faces.context.FacesContext;
import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
import org.apache.myfaces.trinidad.util.Service;
import com.labosun.cj.ejb3.entity.Contact;
import com.labosun.cj.ejb3.session.ContactManager;
import com.labosun.cj.web.locator.EjbLocator;
import java.util.List;
/**
* A typical simple backing bean, that is backed to
helloworld.jsp
*
*/
public class Beanlist
{
//properties
private String firstname;
private String lastname;
private String address;
private int zipCode;
private String city;
private String phone;
private String mobile;
private List<Contact> Listcontact;
/**
* default empty constructor
*/
public Beanlist()
{
}
//-------------------getter & setter
//debut
public String getfirstname()
{
//firstname = "anis";
return firstname;
}
public void setfirstname(String name)
{
this.firstname = name;
}
//fin
//debut
public String getlastname()
{
return lastname;
}
public void setlastname(String name)
{
this.lastname = name;
}
//fin
//debut
public String getaddress()
{
return address;
}
public void setaddress(String name)
{
this.address = name;
}
//fin
//debut
public int getzipCode()
{
return zipCode;
}
public void setzipCode(int name)
{
this.zipCode = name;
}
//fin
//debut
public String getcity()
{
return city;
}
public void setcity(String name)
{
this.city = name;
}
//fin
//debut
public String getphone()
{
return phone;
}
public void setphone(String name)
{
this.phone = name;
}
//fin
//debut
public String getmobile()
{
return mobile;
}
public void setmobile(String name)
{
this.mobile = name;
}
//fin
public List<Contact> getListcontact()
{
ContactManager contactManager = EjbLocator.getLocator().getContactManager();
Listcontact = contactManager.getlistContact();
System.out.println(Listcontact.toString());
return Listcontact;
}
}
[/code]
et ma jsf est :
[code]
<tr:table value="#{Beanlist.Listcontact}" var="entry">
<tr:column>
<tr:outputText value="entry.firstname"></tr:outputText>
</tr:column>
</tr:table>
[/code]
A voir également:
- Passage de parametre entre un beam est jsf
- Remettre parametre usine pc - Guide
- Parametre dns - Guide
- Parametre windows - Guide
- Passage qwerty azerty - Guide
- Netflix paramètre compte - Guide
1 réponse
Bonjour,
j'ai trouver l'erreur c'est la specification des bean il ne faut pas commencer un attribut avec une majiscule;
mais al'issue de cela je n'ai pas d'erreur mais au lieu d'avoir les nom j'ai eu comme cela:
Code :
entry.firstname
entry.firstname
entry.firstname
entry.firstname
entry.firstname
entry.firstname
entry.firstname
et mon code est:
Code :
<tr:table value="#{Beanlist.Listcontact}" var="entry">
<tr:column>
<tr:outputText value="entry.firstname"></tr:outputText>
</tr:column>
</tr:table>
j'ai trouver l'erreur c'est la specification des bean il ne faut pas commencer un attribut avec une majiscule;
mais al'issue de cela je n'ai pas d'erreur mais au lieu d'avoir les nom j'ai eu comme cela:
Code :
entry.firstname
entry.firstname
entry.firstname
entry.firstname
entry.firstname
entry.firstname
entry.firstname
et mon code est:
Code :
<tr:table value="#{Beanlist.Listcontact}" var="entry">
<tr:column>
<tr:outputText value="entry.firstname"></tr:outputText>
</tr:column>
</tr:table>