Re: [Struts 2] Date conversion general bug!
Hi, I solved my problem replacing the xwork library by xwork-2.0.8-SNAPSHOT.jar. I was necessary to download the source of this version and build it. Aloha, Rafael Sobral Sparecreative wrote: I agree that date conversion is a real problem for S2, especially in multi lingual applications. We¹ve had to implement our own converter which either looks for a format value with the date string or picks up a list of default prioritised date formats and tries each one successively until success or failure with all. Ideally it would be good if we could configure S2 out of the box (so to speak) to perform the same functionality. By that I mean that in struts.xml or by convention file you could specify locale or a comma separated list of date formats to try for both short (date only) and long (date and time) values. Z. -- View this message in context: http://www.nabble.com/-Struts-2--Date-conversion-general-bug%21-tp17369156p24740599.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [Struts 2] Date conversion general bug!
Hi, I think this link can help. http://jira.opensymphony.com/browse/XW-670 Aloha, Rafael Sobral Milan Milanovic wrote: I'm sorry, but I finally got what is the problem. I'm sending in this thread and I want people on the list know what I have find. It very bad that nobody from Struts team want to help with this simple problem and that people get stuck with their projects for weeks because of such things. It is not acceptable in real-world use. Jim Kiley jhki...@summa-tech.com wrote: It is possible that sending your complete step-by-step development process as responses to yourself on the mailing list is not the most productive way to solve this problem. On Wed, May 21, 2008 at 10:50 AM, Milan Milanovic wrote: No, Struts 2 only support MM/dd/ date format and accepts it, when I change to dd.MM. I got that error: ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting... -- Thx. Milan Milanovic wrote: Yes, this was the same problem with too. All dates must be in this format to work: MM.dd.! How can I change this ? I tried with displayFormat attribute and to define it in package.properties, but it doesn't work. Can this be done for complete application ? -- Thx in advance, milan Milanovic Milan Milanovic wrote: The wierd thing, even if my date is wrote in dd.MM. format in textfield, if I enter date in dd/MM/ format then it works without this error ? What is the problem ? Maybe the same problem is with datetimepicker ? -- Thx in advance, Milan Milan Milanovic wrote: Regarding this theme: http://www.nabble.com/-Struts-2--Datetimepicker-tag-Bug--%21-td17322058.html I must reply in this way, because when I give reply to the message above struts mailing list returns that my e-mail is SPAM?! No, the thing is very simple. I have in my jsp that is connected to Date object in my action class, as it is shown in Struts documentation, but I still got that error. No, I have set displayFormat attribute like this: displayFormat=dd.MM., and it read good from my Date object in action class, but when I sumbit the form it generates that ParametersException ERROR. It seems that Struts 2 doesn't know how to convert String value from to Date field. I tried everything! Even 3 different browsers, multiple locale settings, etc. I now tried to do the same thing but with , in this way, I defined in package.properties: format.date = {0,date,dd.MM.} and then I my .jsp page: And it reads good my date (of type java.util.Date from action class) field, but when I submit the form I got the same error: ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor:204 - ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 'date' on 'class com.myProject.test.MyAction: Error setting expression 'date' with value '[Ljava.lang.String;@106121' I have get/set methods for date, and everything else works fine. What is the problem with Date conversion in this Struts 2.0.1.11 ? -- Please help! -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com -- View this message in context: http://www.nabble.com/-Struts-2--Date-conversion-general-bug%21-tp17369156p24526267.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: using CompositeActionMapper
I have used the following with success in Mac Os Leopard Tomcat 6.0.18 Struts 2.0.14 Java 1.5.0.19 bean type=org.apache.struts2.dispatcher.mapper.ActionMapper name=waves class=struts2.urlrewrite.WavesASPActionMapper / bean type=org.apache.struts2.dispatcher.mapper.ActionMapper name=hierarchy class=struts2.urlrewrite.WavesHierarchyActionMapper / constant name=struts.mapper.composite value=struts,waves,hierarchy / constant name=struts.mapper.class value=composite/ When I moved to CentOs Tomcat 6.0.18 Struts 2.0.14 Java 1.6.0_10 it start throwing java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:290) at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:117) at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:115) at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:542) at com.opensymphony.xwork2.inject.ContainerImpl.injectStatics(ContainerImpl.java:114) at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:494) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:145) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:177) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:136) at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:49) at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:431) at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:446) at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:48) at
Re: using CompositeActionMapper
Hi, I dont not understand very much about Struts2 inject process but I fixed my problem extending the compositeActionMapper with the following one: public class DebugCompositeActionMapper extends CompositeActionMapper { @Override @Inject(StrutsConstants.STRUTS_MAPPER_COMPOSITE) public void setActionMappers(String list) { if (list != null) { String[] arr = list.split(,); for (String name : arr) { if (container==null) continue; // LINE ADDED Object obj = container.getInstance(ActionMapper.class, name); if (obj != null) { actionMappers.add((ActionMapper) obj); } } } } } I worked since it do not throw the Null Pointer Exception and it seem during injection process the function setActionMappers is called twice. One before the container is set and other after. I hope it help. Aloha, Rafael Sobral rsilva wrote: I have used the following with success in Mac Os Leopard Tomcat 6.0.18 Struts 2.0.14 Java 1.5.0.19 bean type=org.apache.struts2.dispatcher.mapper.ActionMapper name=waves class=struts2.urlrewrite.WavesASPActionMapper / bean type=org.apache.struts2.dispatcher.mapper.ActionMapper name=hierarchy class=struts2.urlrewrite.WavesHierarchyActionMapper / constant name=struts.mapper.composite value=struts,waves,hierarchy / constant name=struts.mapper.class value=composite/ When I moved to CentOs Tomcat 6.0.18 Struts 2.0.14 Java 1.6.0_10 it start throwing java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:290) at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:117) at com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:115) at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:542) at com.opensymphony.xwork2.inject.ContainerImpl.injectStatics(ContainerImpl.java:114) at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:494) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:145) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288