[jboss-user] [JBoss Seam] - Re: selectOneMenu and commandButton conflict
grdzeli_kaci
do-not-reply at jboss.com
Tue Feb 20 07:51:51 EST 2007
"petemuir" wrote : You've probably got errors occuring on the coversion, validation or update model phase. Put an h:messages component on the page to see.
hi petemuir,
u're right i put h:messages into login page and i got an error like this :
| . value could not be converted to the expected type
|
i wrote my own converter as you told me
| @Transactional
| public Converter getApplicationConverter() {
| return new Converter() {
|
| @Transactional
| public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) throws ConverterException {
| if (arg2 == null) {
| return null;
| }
| try {
| return ((EntityManager) Component.getInstance("entityManager")).find(Application.class, Integer.valueOf(arg2));
| } catch (NumberFormatException e) {
| throw new ConverterException("Cannot Find Selected Language", e);
| }
| }
|
| @Transactional
| public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) throws ConverterException {
| if (arg2 instanceof Language) {
| Application application = (Application) arg2;
| return application.getName().toString();
| } else {
| return null;
| }
| }
|
| };
| }
|
here is my entity bean :
| @Entity
| @Table(name = "APPLICATION",schema="BillAdmin")
| @Name("application")
| @Scope(ScopeType.SESSION)
| public class Application implements Serializable {
|
| @Id
| @Column(name = "APPLICATION_ID", nullable = false)
| private BigDecimal applicationId;
|
| @Column(name = "NAME")
| private String name;
|
| @Column(name = "CODE")
| private BigInteger code;
|
| @Column(name = "DESCRIPTION")
| private String description;
|
| @Column(name = "REMARK")
| private String remark;
|
| @Column(name = "REC_STATUS")
| private BigInteger recStatus;
|
| @Column(name = "USER_ID")
| private BigInteger userId;
|
| @Column(name = "REG_DATE")
| @Temporal(TemporalType.DATE)
| private Date regDate;
|
| @Column(name = "UPD_DATE")
| @Temporal(TemporalType.DATE)
| private Date updDate;
|
| @OneToMany(cascade = CascadeType.ALL, mappedBy = "applicationId")
| private Collection<ApplicationsConfig> applicationsConfigCollection;
|
| public Application() {
| }
|
| public Application(BigDecimal applicationId) {
| this.applicationId = applicationId;
| }
|
| public BigDecimal getApplicationId() {
| return this.applicationId;
| }
| public void setApplicationId(BigDecimal applicationId) {
| this.applicationId = applicationId;
| }
|
| public String getName() {
| return this.name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| public BigInteger getCode() {
| return this.code;
| }
| public void setCode(BigInteger code) {
| this.code = code;
| }
|
| public String getDescription() {
| return this.description;
| }
|
| public void setDescription(String description) {
| this.description = description;
| }
|
| public String getRemark() {
| return this.remark;
| }
|
| public void setRemark(String remark) {
| this.remark = remark;
| }
|
| public BigInteger getRecStatus() {
| return this.recStatus;
| }
|
| public void setRecStatus(BigInteger recStatus) {
| this.recStatus = recStatus;
| }
|
| public BigInteger getUserId() {
| return this.userId;
| }
| public void setUserId(BigInteger userId) {
| this.userId = userId;
| }
| public Date getRegDate() {
| return this.regDate;
| }
| public void setRegDate(Date regDate) {
| this.regDate = regDate;
| }
| public Date getUpdDate() {
| return this.updDate;
| }
| public void setUpdDate(Date updDate) {
| this.updDate = updDate;
| }
| public Collection<ApplicationsConfig> getApplicationsConfigCollection() {
| return this.applicationsConfigCollection;
| }
| public void setApplicationsConfigCollection(Collection<ApplicationsConfig> applicationsConfigCollection) {
| this.applicationsConfigCollection = applicationsConfigCollection;
| }
| @Override
| public int hashCode() {
| int hash = 0;
| hash += (this.applicationId != null ? this.applicationId.hashCode() : 0);
| return hash;
| }
| @Override
| public boolean equals(Object object) {
| if (!(object instanceof Application)) {
| return false;
| }
| Application other = (Application)object;
| if (this.applicationId != other.applicationId && (this.applicationId == null || !this.applicationId.equals(other.applicationId))) return false;
| return true;
| }
|
| @Override
| public String toString() {
| return "com.magti.seam.beans.billAdmin.Application[applicationId=" + applicationId + "]";
| }
| }
|
can u tell me why i got this error ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019308#4019308
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019308
More information about the jboss-user
mailing list