• Post Reply Bookmark Topic Watch Topic
  • New Topic

This has to be the strangest thing...  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, this is so strange because I swear this worked before and all of a sudden, it doesn't. I mean, it worked 2 days ago. And now it has stopped. I haven't changed anything.

If I declare the value of a selectonemenu as a String when I postback to the page, the dropdown contains the selected value. If I declare the value as an Integer, it defaults back to the first one in the list. Here is the example...





Now, if you go in and change the type for choose to String, it works. Otherwise it won't. I can probably use a converter if I need to or something, but I don't understand why 2 days ago it worked and now it doesn't. Can anyone else confirm that it does or does not work? I asummed JSF had auto conversion for basic types (Long, Integer, String, etc). I may be wrong and it may have been working all along when it really should'nt have.

Thanks.
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am not sure, but I think the type (Integer, String) wouldn't matter unless these two Objects are of same type.

Are you getting the error while submitting the page?
 
Vladimir Bezugliy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try add <h:messages> on your page :-)

You should either use

or

[ March 16, 2005: Message edited by: Vladimir Bezugliy ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Yeah, that was it. I need sleep.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!