[jboss-user] [JBoss Seam] - Re: Question on Converter
hasc
do-not-reply at jboss.com
Sun Apr 1 12:14:26 EDT 2007
sorry i was wrong. it seems to use the converter.
i have a question regarding the converter.
#{calculator.area}
the expression references a property which is defined here:
@Stateful
| class CalculatorBean implements Calculator
|
| float area;
| public void setArea(float area)
| {
| this.area = area;
| }
|
| public float getArea()
| {
| return area;
| }
|
| public void calculate(){do something}
|
now what i want is, that if the property area is not set, the form field should be empty.
if no converter is specified #{calculator.area} is rendered to "0.0".
I tried the following in the toString method of the AreaConverter class:
| public String getAsString(FacesContext facesContext, UIComponent component, Object obj)
| {
| if(obj == null || obj.equals(0.0))
| {
| String str = "";
| return str;
| }
|
| return obj.toString();
| }
|
but it still returns "0.0"
has somone a hint why this happens?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033538#4033538
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033538
More information about the jboss-user
mailing list