Hello, I did a Action to test the cast in WebWork.
All the casts works well: int, float, double,
boolean, Date, but Iīm problems with the "char" cast ...
In my action the "charField" isnīt set with the
correct value, is always set to ''\u0000"...
where is my mistake?
thanks
---------------------------------------------------------
#bodytag(Form "action=''"
"method='get'")
#tag( TextField "label='booleanField'"
"name='booleanField'" "size='50'" )
#tag( TextField "label='charField'" "name='charField'" "size='50'" ) #tag( TextField "label='intField'" "name='intField'" "size='50'" ) #tag( TextField "label='longField'" "name='longField'" "size='50'" ) #tag( TextField "label='floatField'" "name='floatField'" "size='50'" ) #tag( TextField "label='doubleField'" "name='doubleField'" "size='50'" ) #tag( TextField "label='stringField'" "name='stringField'" "size='50'" ) #tag( TextField "label='dateField'" "name='dateField'" "size='50'" ) #tag(Submit "value='Submit'" )
#end
--------------------------------------------------------- public class CastAction implements
Action
{ private boolean booleanField; private char charField; private int intField; private long longField; private float floatField; private double doubleField; private String stringField; private Date dateField = new Date(); public String execute() throws
Exception
{ System.out.println(new Date()); System.out.println("booleanField : " + booleanField); System.out.println("charField : " + charField); System.out.println("intField: " + intField); System.out.println("longField: " + longField); System.out.println("floatField: " + floatField); System.out.println("doubleField: " + doubleField); System.out.println("stringField: " + floatField); System.out.println("dateField: " + doubleField); // charField always is empty if(charField == '\u0000'){ System.out.println("char nulo!"); charField = 'R'; } return SUCCESS; } // GET/SET
---------------------------------------------------------
|