---
title: "<s:bean>"
author: "conkeyn"
date: "2011-02-27T18:32:09Z"
tags: []
categories: ["企业架构"]
slug: "s-bean"
draft: false
lastmod: "2011-02-27T18:32:09Z"
id: 932604
url: "https://conkeyn.iteye.com/blog/932604"
---

```
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&deg;F=<s:property value="#converter.celcius"/>&deg;C
```