This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes How to display java.lang.Double using Struts in the front end Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to display java.lang.Double using Struts in the front end" Watch "How to display java.lang.Double using Struts in the front end" New topic
Author

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

adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
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
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to display java.lang.Double using Struts in the front end
 
Similar Threads
CMP 2.0 problem with MySQL server
Problem with logic:iterate
CMP beans not entering data in database
CMP EJB Creation with id generated by an independent class
Entity Bean on JBoss4.0.2