• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Struts 1.3 - html:option doesn't select Integer value

 
Ranch Hand
Posts: 363
Firefox Browser Redhat Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using Struts 1.3 for my application. I found that Struts is not 'selecting' a value if the value type is Integer in html:select and html: option. It's selecting if the type is String. Why? See the below code:


Where roleId is an Integer and roleName is String.

The web page displays:


As you can see, there is no 'selected' property for Integer values. Can someone explain why? What is the solution for this?

Many thanks in adv.!
 
author & internet detective
Posts: 42173
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your type and int or an Integer? If the later, can you try it with int? Struts was developed before autoboxing so it might not know what to do with mixed types.

A workaround of course would be to use String. Or to add an if statement in the JSP to set the selection.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic