conkeyn 发表于 2013-1-26 15:58:41

<s:bean>

public class DegreeConverter {    private float celcius;    private float fahrenheit;    public float getCelcius() {      return (fahrenheit - 32)*5/9;    }    public void setCelcius(float celcius) {      this.celcius = celcius;    }    public float getFahrenheit() {      return celcius * 9 / 5 + 32;    }    public void setFahrenheit(float fahrenheit) {      this.fahrenheit = fahrenheit;    }} HTML页面:
<s:bean name="app06a.DegreeConverter" id="converter">      <s:param name="fahrenheit" value="212"/></s:bean>212°F=<s:property value="#converter.celcius"/>°C
页: [1]
查看完整版本: <s:bean>