I want to convert Date(ActionScript 3) to java.util.Date through a xml.
First, write a user defined ActionScript class like this.
public class User
{
public function User()
{
userDate = new Date();
}
public var id:String = null;
public var password:String = null;
public var userDate:Date = null;
}
Second, create its instance and set each of values, so it converts ActionScript class to a xml for using XMLEncoder having its schema file.
This is the result xml, and send this xml to a server for using a HTTPService.
<User>
<id>system</id>
<password>manager</password>
<userDate>Fri Jan 14 09:02:17 GMT+0900 2011</userDate>
</User>
Finally, In server side of Java, I want to convert this xml to Java class like this for using JAXB Unmarshaller.
public class User {
public User() {
}
private String id;
private String password;
private Date userDate;
public void setId(String id) {
this.id = id;
}
public void setPassword(String password) {
this.password = password;
}
public void setUserDate(Date userDate) {
this.userDate = userDate;
}
public String getId() {
return id;
}
public String getPassword() {
return password;
}
public Date getUserDate() {
return userDate;
}
}
But, as a result, "UserDate" property is only going to be null...
Why "UserDate" property is null ?
And, please tell me solutions if any.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…