struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yasser Zamani <yasser.zam...@live.com>
Subject Re: Struts 2.6
Date Tue, 28 Nov 2017 09:15:47 GMT


On 11/28/2017 12:36 PM, Greg Huber wrote:
> where do these live now? does not compile for me.
> 
> *ThemeDescriptorConverter.java*
> 
> import org.apache.struts.model.ThemeDescriptor;
> import org.apache.struts.model.Themes;

No I mentioned those as examples. You instead should write your own, 
like below:

package com.mycompany.blahblah /*update this to your one*/

public class MyDoubleWithDotZeroStringConverter extends 
com.opensymphony.xwork2.conversion.impl.StringConverter
{
@Override
     protected String convertToString(Locale locale, Object value) {
         if (Double.class.isInstance(value)) {
             NumberFormat format = NumberFormat.getNumberInstance(locale);
             format.setGroupingUsed(false);
             format.setMinimumFractionDigits(1);
             format.setMaximumFractionDigits(Integer.MAX_VALUE);
             return format.format(value);
         } else {
             return super.convertToString(locale, value);
         }
     }

}
Mime
View raw message