[jboss-user] [JBoss Seam] - Re: selectOneMenu and selectItems problem

2007-07-12 Thread [EMAIL PROTECTED]
It probably subtley altered the way in which your variables were scoped.  The 
way you have written your code doesn't require it.  milli is correct - you need 
to make sure the selected object appears in the original list, otherwise 
validation fails. 

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4063393#4063393

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4063393
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: selectOneMenu and selectItems problem

2007-07-11 Thread mttu
[EMAIL PROTECTED] wrote : Any output from h:messages?


Hi, 
message from h:messages is:

value is not valid

but why ?

 the Converter class:


  | @Name(CompanyConverter)
  | @Converter
  | public class CompanyConverter implements javax.faces.convert.Converter, 
Serializable {
  | 
  | @Logger
  | private Log log;
  | 
  | @In(required = false)
  | ListCompany companies;
  | 
  | /*
  |  * @see 
javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
  |  *  javax.faces.component.UIComponent, java.lang.String)
  |  */
  | public Object getAsObject(FacesContext arg0, UIComponent arg1, String 
string) throws ConverterException {
  | if (string == null || string.length() == 0) {
  | return null;
  | }
  | 
  | long id = Long.valueOf(string).longValue();
  | log.info([getAsObject] string -  + string);
  | log.info([getAsObject] id -  + id);
  | log.info([getAsObject] companies -  + companies);
  | if (companies != null) {
  | for (Company referenceData : companies) {
  | if (referenceData.getId() == id) {
  | log.info([getAsObject] returning -  
+ referenceData);
  | return referenceData;
  | }
  | }
  | }
  | log.info([getAsObject] returning - null );
  | return null;
  | }
  | 
  | /*
  |  * @see 
javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
  |  *  javax.faces.component.UIComponent, java.lang.Object)
  |  */
  | public String getAsString(FacesContext arg0, UIComponent arg1, Object 
obj) throws ConverterException {
  | log.info([getAsString] obj -  + obj);
  | if (obj == null) {
  | return null;
  | }
  | Company company = (Company) obj;
  | log.info([getAsString] company -  + company);
  | return String.valueOf(company.getId());
  | }
  | 
  | }
  | 

Both methods return not null values.

Any idea ?

Thanks, 
Mttu


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4062936#4062936

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4062936
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: selectOneMenu and selectItems problem

2007-07-11 Thread milli
If you are converting ID from long to string and vice versa, why don't you try 
s:convertEntity /. But you would still get the same error unless you override 
equals in your Company class to equate id's.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4063094#4063094

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4063094
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: selectOneMenu and selectItems problem

2007-07-11 Thread mttu
OK, it started to worked after i had changed:


  | @Out
  | private Company selectedCompany;
  | 

and implemented equals in Company.

It's still not clear to me why selectedCompany should be outjected in this case.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4063119#4063119

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4063119
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: selectOneMenu and selectItems problem

2007-07-11 Thread trickyvail
If your Company object is an entity you need to be aware of:

http://hibernate.org/109.html

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4063133#4063133

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4063133
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: selectOneMenu and selectItems problem

2007-07-11 Thread mttu
But why selected company has to be outjected ?


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4063236#4063236

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4063236
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: selectOneMenu and selectItems problem

2007-07-10 Thread [EMAIL PROTECTED]
Any output from h:messages?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4062731#4062731

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4062731
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user