struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Wang" <kw...@pcgi.on.ca>
Subject what will happen if I have Data Types other than java.lang.String in my formbean - say java.util.date?
Date Fri, 08 Feb 2002 23:02:16 GMT
I have a formbean which include a field its type is java.util.Date, and I
have two methods to get and set
like these :
		Date getMyField() { return dateVar; }
		void setMyField(Date date ){ dateVar = date ;}

Now I use <html:text> to display this field, it displays the Date with the
'yyyy-mm-dd' format, I am wondering can I change the format?

Another big issue is I can not submit my form, when I submit my form
exception happens:

java.lang.IllegalArgumentException: argument type mismatch 	at
java.lang.reflect.Method.invoke(Native Method) 	at
org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:98
8) 	at
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:90
4) 	at
org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932) 	at
org.apache.struts.util.BeanUtils.populate(BeanUtils.java:509) 	at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:772) 	at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:20
61) 	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1563) 	at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) 	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760) 	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 	at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) 	at
org.apache.tomcat.core.Handler.service(Handler.java:287) 	at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) 	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2) 	at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)


I know if I change the getter and setter method to String everything is OK,
but can struts supports java.util.Date in formbean?

thanks in advance
Kevin


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message