• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to display java.lang.Double using Struts in the front end

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I want to display a hospital list using struts.

Here is the problem.
I have a hospitaldata value object.
Hospital data contains the following fields

String hospitalname;
String hospitalcity;
Double hospitalid;
Integer zipcode;


I put all the hospitaldata objects in to an arrayList and set it in the request object.

I want to display the hospitalname to the user.
But when the user submits the form the hospitalid should be submitted.

Can anyone tell me how this is done.
I feel logic:iterate can be used.
But it gives problem when displaying Double values.Has anyone solved this problem.

Thanks for your help
With Regards
Adrian
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way to do this would be to add a getFormattedHospitalId() and setFormattedHospitalId() method to your hospitaldata class. Have the getter method return a string which represents the the double value formatted using java.text.NumberFormat, and have the setter method convert the string to a double. You would then use the property formattedHospitalId in your jsp rather than hospitalId.
reply
    Bookmark Topic Watch Topic
  • New Topic