开发者

Struts 2 data transfer and type conversions for primitive types

开发者 https://www.devze.com 2022-12-12 14:53 出处:网络
I\'m using java beans with automatic data transfer and type conversion. Ex: public class MyAction { public String execute(){

I'm using java beans with automatic data transfer and type conversion. Ex:

public class MyAction
{
  public String execute(){
//   ....
  }

private double price;
public getPrice(){
   return price;
}

public setPrice(double price){
  this.price=pri开发者_C百科ce;
}
}

Let my request to be http://localhost:8080/my.action?price=21.3 Then in the setPrice I'll get price variable value equal to 213. I thing this occur because of the romanian culture set. In this cultures double are presented as 21,3 and not 21.3 as in the others. In .NET there is something called as InvariantCulture for this cases. How can I do something similar in Struts and where should be this settings specified.


Do you have your struts.properties set?

Example:

struts.locale=en_US
struts.i18n.encoding=UTF-8

struts.properties

0

精彩评论

暂无评论...
验证码 换一张
取 消