• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 355
Redhat Chrome 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: 40913
840
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.
reply
    Bookmark Topic Watch Topic
  • New Topic