RE: BeanUtils Date Converter
Of course, right after I sent the email, I figured out my problem. I created the following class, then registered it in my ContextListener using this line: ConvertUtils.register(new SqlDateConverter(), java.sql.Date.class); package com.caris.pmis.util; import java.sql.Date; import org.apache.commons.beanutils.Converter; import org.apache.commons.beanutils.converters.*; public class SqlDateConverter implements Converter { private org.apache.commons.beanutils.converters.SqlDateConverter sqlDateConverter = new org.apache.commons.beanutils.converters.SqlDateConverter(); public Object convert(Class type, Object value) { if(value == null || value.toString().length() 1) return null; return sqlDateConverter.convert(type, value); } } Cheers, Graham -Original Message- From: Graham Lounder [mailto:[EMAIL PROTECTED] Sent: January 19, 2004 3:30 PM To: [EMAIL PROTECTED] Subject: BeanUtils Date Converter Hey all, I know this question has been addressed numerous times but I can't seem to find the answer. I'm trying to convert strings in my forms to java.sql.Date in my dto. Its throwing a conversion error when my form value is null or blank. Is there a way to get nulls or passed through the BeanUtils.copyProperties function? I read that I may be able to create my own converters too. Is there any documentation on this? Cheers, Graham Graham Lounder - Java Developer Spatial Components Division CARIS www.caris.com Tel: +1-506-458-8533 Fax: +1-506-459-3849 CARIS has expanded to new office facilities. Our new mailing address is: 115 Waggoners Lane, Fredericton, New Brunswick, E3B 2L4, Canada. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BeanUtils Date Converter
Graham, I believe that you need to specify the null returned value: ConvertUtils.registerConverter(new SqlDateConverter(null), java.sql.Date.class); On 2004-Jan-19 15:01, Graham Lounder wrote: Hey all, I know this question has been addressed numerous times but I can't seem to find the answer. I'm trying to convert strings in my forms to java.sql.Date in my dto. Its throwing a conversion error when my form value is null or blank. Is there a way to get nulls or passed through the BeanUtils.copyProperties function? I read that I may be able to create my own converters too. Is there any documentation on this? Cheers, Graham Graham Lounder - Java Developer Spatial Components Division CARIS www.caris.com Tel: +1-506-458-8533 Fax: +1-506-459-3849 CARIS has expanded to new office facilities. Our new mailing address is: 115 Waggoners Lane, Fredericton, New Brunswick, E3B 2L4, Canada. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Nick Heudecker System Mobile, Inc. Email: [EMAIL PROTECTED] Web: http://www.systemmobile.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils use in struts
Hi Craig, Thanx for your comments. It uses reflection on POJOs (plain old Java objects) but not on DynaBeans -- the implementation inside DynaActionForm is a HashMap with typesafe getters and setters. In my case I have a Custom DTO with setter/getters and a Form bean that extends DynaActionForm (with properties declared in struts config). However, BeanUtils.copyProperties() works for calling both BeanUtils.copyProperties(form,dto) and For BeanUtils.copyProperties(dto, form) ... Is it supposed to work like that, or is it weird that it's working in both Ways when I have a DynaActionForm? Thanx and regards marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils use in struts
Quoting Marco Mistroni [EMAIL PROTECTED]: Hi Craig, Thanx for your comments. It uses reflection on POJOs (plain old Java objects) but not on DynaBeans -- the implementation inside DynaActionForm is a HashMap with typesafe getters and setters. In my case I have a Custom DTO with setter/getters and a Form bean that extends DynaActionForm (with properties declared in struts config). However, BeanUtils.copyProperties() works for calling both BeanUtils.copyProperties(form,dto) and For BeanUtils.copyProperties(dto, form) ... Is it supposed to work like that, or is it weird that it's working in both Ways when I have a DynaActionForm? Yes it is supposed to work that way. Inside the PropertyUtils methods, it looks at the origin and destination beans individually, and uses reflection (or not) based on that. So, any combination of POJO and DynaBean works. In addition, your origin object can also be a Map (although currently the destination cannob be). Thanx and regards marco Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils use in struts
Hi, We had teh same question.But I have read that the performance issue with reflection has been resolved from jdk1.3 and jdk 1.4 so that it is almost undetectable.Check the release notes for those versions of jdk to get more details about the same. HTH. regards, Shirish -Original Message- From: Marco Mistroni [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 11:27 AM To: 'Struts Users Mailing List' Subject: BeanUtils use in struts Hi all, I have a question about using BeanUtils in Struts. For saving me from writing lot of code, I am using DynaActionForms in my pages. In the backend, I have some DTOs, so I decided in order to make My app more 'extensible' without rewriting too much code, to use BeanUtils to populate my DTOs with values from DynaActionForm, and to Use the same mechanism to populate DynaActionForm from DTO. Now, pls correct me if I am wrong, but BeanUtils uses reflection in Order to populate properties.. I have read from some books ('Effective Java') that using reflection Is much slower than invoking methods normally.. In my app, I will gain flexibility (I don't need to write methods for Populating dtos from form and vice versa), but am I going to lose much In tems of performance? Anyone can give his comments? I think BeanUtils is of great help,and it would be a pity to give up the benefits that I get from it... Best regards marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils use in struts
Reflection has gotten much, much faster than it use to be (JDK1.3 and JDK1.4 made a lot of improvements in speed). Also consider that a lot of custom tags use reflection already (JSTL, Struts tags). If you are using JSP, and custom tags than you are already using reflection all over the place. Also consider that Struts using BeanUtils internally to populate the ActionForm from the incomming request object. In the general scheme of things the overhead of BeanUtils is dust on the scale (for the usage you are talking about). If you are really worried, use JUnitPerf and create a test that uses BeanUtils and stress it. I am sure there are much more effective ways to tune your web application (like caching semi-dynamic pages and page fragments). Rick Hightower Developer Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm Struts/J2EE consulting -- http://www.arc-mind.com/consulting.htm#StrutsMentoring -Original Message- From: Marco Mistroni [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 3:27 AM To: 'Struts Users Mailing List' Subject: BeanUtils use in struts Hi all, I have a question about using BeanUtils in Struts. For saving me from writing lot of code, I am using DynaActionForms in my pages. In the backend, I have some DTOs, so I decided in order to make My app more 'extensible' without rewriting too much code, to use BeanUtils to populate my DTOs with values from DynaActionForm, and to Use the same mechanism to populate DynaActionForm from DTO. Now, pls correct me if I am wrong, but BeanUtils uses reflection in Order to populate properties.. I have read from some books ('Effective Java') that using reflection Is much slower than invoking methods normally.. In my app, I will gain flexibility (I don't need to write methods for Populating dtos from form and vice versa), but am I going to lose much In tems of performance? Anyone can give his comments? I think BeanUtils is of great help,and it would be a pity to give up the benefits that I get from it... Best regards marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils use in struts
Reflection in 1.3 , 1.4 is much faster than it was in ancient java versions, but is still slow compared to for example, using maps, etc. In the case of a struts app for use with DTOs however, the difference is not going to be of significance. In general, for most such applications it is such things as access to the database that is the bottleneck, and also speed on the network, etc... A difference of a couple of nanoseconds to populate a DTO bean based on a user submission - or a dynabean from a bean for ui display... I mean really - its quite irrelevant. Even if you have 5000 users online simultaneously its probably not the bean population thats going to be causing you problems... Ive found it never works to try and think in terms of meaningless absolutes like reflection is slow. It always depends on the context of your problem. If you need to populate a million beans in a tight loop, reflection may not be your best bet, but for populating a few dynabeans here and there ... the performance difference is irrelevant. Abandoning reflection may get your request processing time down from 1000 milliseconds to 999 milliseconds or something like that... (I dont have the actual figures) I personally have found that leveraging BeanUtils, has proven very productive. It is very useful, and you wont regret the flexibility that comes with it. Heres a link to an older (2001) posting by Ted that itself contains quite a few relevant links. Worth a read: http://www.mail-archive.com/[EMAIL PROTECTED]/msg14397.html hth Andrew -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, 7 January 2004 18:41 To: [EMAIL PROTECTED] Subject: RE: BeanUtils use in struts Hi, We had teh same question.But I have read that the performance issue with reflection has been resolved from jdk1.3 and jdk 1.4 so that it is almost undetectable.Check the release notes for those versions of jdk to get more details about the same. HTH. regards, Shirish -Original Message- From: Marco Mistroni [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 11:27 AM To: 'Struts Users Mailing List' Subject: BeanUtils use in struts Hi all, I have a question about using BeanUtils in Struts. For saving me from writing lot of code, I am using DynaActionForms in my pages. In the backend, I have some DTOs, so I decided in order to make My app more 'extensible' without rewriting too much code, to use BeanUtils to populate my DTOs with values from DynaActionForm, and to Use the same mechanism to populate DynaActionForm from DTO. Now, pls correct me if I am wrong, but BeanUtils uses reflection in Order to populate properties.. I have read from some books ('Effective Java') that using reflection Is much slower than invoking methods normally.. In my app, I will gain flexibility (I don't need to write methods for Populating dtos from form and vice versa), but am I going to lose much In tems of performance? Anyone can give his comments? I think BeanUtils is of great help,and it would be a pity to give up the benefits that I get from it... Best regards marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BeanUtils use in struts
Quoting Marco Mistroni [EMAIL PROTECTED]: Hi all, I have a question about using BeanUtils in Struts. For saving me from writing lot of code, I am using DynaActionForms in my pages. In the backend, I have some DTOs, so I decided in order to make My app more 'extensible' without rewriting too much code, to use BeanUtils to populate my DTOs with values from DynaActionForm, and to Use the same mechanism to populate DynaActionForm from DTO. Now, pls correct me if I am wrong, but BeanUtils uses reflection in Order to populate properties.. It uses reflection on POJOs (plain old Java objects) but not on DynaBeans -- the implementation inside DynaActionForm is a HashMap with typesafe getters and setters. I have read from some books ('Effective Java') that using reflection Is much slower than invoking methods normally.. In my app, Depends totally on what JVM you are using -- the answer changes with every version. Whether it's visible to you (in terms of increased response time) is even more variable, but in most web based environments the database is the primary cause for delays, followed by network traffic. The only way that reflection can make any difference at all is if you're CPU bound on your web tier server. I will gain flexibility (I don't need to write methods for Populating dtos from form and vice versa), but am I going to lose much In tems of performance? Depends on your application environment (as described above), but it's pretty unikely to cause a problem -- especially if you use dynabeans, which don't use reflection at all :-). Anyone can give his comments? I think BeanUtils is of great help,and it would be a pity to give up the benefits that I get from it... The only way to know if this matters in your application is to benchmark your application. But there are thousands of Struts-based webapps in the world, many using traditional ActionForms (and therefore heavily dependent on reflection). Aiming for fastest possible is the wrong target. Aiming for fast enough lets you focus on other goals about your app (less code, easier maintenance, and so on) also. Best regards marco Craig McClanahan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [BeanUtils] Map can or not?
Andrew Hill rta: Are PropertyUtils.populate() and getProperty() (etc...) smart enough to work with a Map instead of a bean and use the property name as a key into it? yes - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [BeanUtils] Map can or not?
Cool. So if I wanted an ActionForm but the fieldname (or some of them) on it were determined only at runtime I could simply make all the 'runtime' fields be nested properties of that ActionForm property that had the Map? input name=bob.anything... public void setBob(Map bob)... public Map getBob() String anything = form.getBob().get(anything); I presume id have to instantiate the Map myself before the form was populated though? -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Wednesday, 18 June 2003 20:11 To: Struts Users Mailing List Subject: Re: [BeanUtils] Map can or not? Andrew Hill rta: Are PropertyUtils.populate() and getProperty() (etc...) smart enough to work with a Map instead of a bean and use the property name as a key into it? yes - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [BeanUtils] Map can or not?
Well, I'd say maybe. Something like the following will work: PropertyUtils.getProperty(map, key) But this won't: PropertyUtils.copyProperties(destMap, srcMap) Nor will: BeanUtils.populate(destMap, srcMap) And if you do: PropertyUtils.describe(map) You get: {class=null, empty=null} Quoting Gemes Tibor [EMAIL PROTECTED]: Andrew Hill írta: Are PropertyUtils.populate() and getProperty() (etc...) smart enough to work with a Map instead of a bean and use the property name as a key into it? yes -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [BeanUtils] Map can or not?
Is this something that might be handled by a normal mapped property with an additional property for getting the names of all the dynamic fields? public Object getDynamicField(String key) { return this.map.get(key); } public void setDynamicField(String key, Object value) { this.map.put(key, value); } public Set getDynamicFieldNames() { return this.map.keySet(); } But your JSP doesn't know the field names ahead of time, so it can't ask for them by name, right? So maybe something like this would work: logic:iterate id=fieldName name=theForm propertydynamicFieldNames html:text property='%= dynamicField( + fieldName + ) %'/ /logic:iterate Quoting Andrew Hill [EMAIL PROTECTED]: Cool. So if I wanted an ActionForm but the fieldname (or some of them) on it were determined only at runtime I could simply make all the 'runtime' fields be nested properties of that ActionForm property that had the Map? input name=bob.anything... public void setBob(Map bob)... public Map getBob() String anything = form.getBob().get(anything); I presume id have to instantiate the Map myself before the form was populated though? -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Wednesday, 18 June 2003 20:11 To: Struts Users Mailing List Subject: Re: [BeanUtils] Map can or not? Andrew Hill írta: Are PropertyUtils.populate() and getProperty() (etc...) smart enough to work with a Map instead of a bean and use the property name as a key into it? yes -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [BeanUtils] Map can or not?
snip But your JSP doesn't know the field names ahead of time, so it can't ask for them by name, right? So maybe something like this would work: /snip Nah mate. Not using JSP. In this case Im actually traversing an xhtml DOM and doing a getProperty() to get values when I encounter input elements (etc...) based on the name attribute and using the result to set the value attribute. (or checked attribute or... whatever... for that type of field) Id quite like the ability to have user defined forms (perhaps I could map names to xpaths in an xml doc for persistance ... or whatever) where the user needs merely to upload the xhtml for the form , and perhaps specify which fields are required etc... and then my app would do the grunt work for rendering/ populating/ etc -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Wednesday, 18 June 2003 21:19 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: [BeanUtils] Map can or not? Is this something that might be handled by a normal mapped property with an additional property for getting the names of all the dynamic fields? public Object getDynamicField(String key) { return this.map.get(key); } public void setDynamicField(String key, Object value) { this.map.put(key, value); } public Set getDynamicFieldNames() { return this.map.keySet(); } But your JSP doesn't know the field names ahead of time, so it can't ask for them by name, right? So maybe something like this would work: logic:iterate id=fieldName name=theForm propertydynamicFieldNames html:text property='%= dynamicField( + fieldName + ) %'/ /logic:iterate Quoting Andrew Hill [EMAIL PROTECTED]: Cool. So if I wanted an ActionForm but the fieldname (or some of them) on it were determined only at runtime I could simply make all the 'runtime' fields be nested properties of that ActionForm property that had the Map? input name=bob.anything... public void setBob(Map bob)... public Map getBob() String anything = form.getBob().get(anything); I presume id have to instantiate the Map myself before the form was populated though? -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Wednesday, 18 June 2003 20:11 To: Struts Users Mailing List Subject: Re: [BeanUtils] Map can or not? Andrew Hill írta: Are PropertyUtils.populate() and getProperty() (etc...) smart enough to work with a Map instead of a bean and use the property name as a key into it? yes -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [BeanUtils] Map can or not?
Andrew Hill rta: Nah mate. Not using JSP. In this case Im actually traversing an xhtml DOM and doing a getProperty() to get values when I encounter input elements (etc...) based on the name attribute and using the result to set the value attribute. (or checked attribute or... whatever... for that type of field) And you sad you need an answer for a yesno question! :) Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [BeanUtils] Map can or not?
hehe Guess I was getting greedy. Still I got most of the info I needed. Many thanks to Kris and yourself for providing it. :-) -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Wednesday, 18 June 2003 21:34 To: Struts Users Mailing List Subject: Re: [BeanUtils] Map can or not? Andrew Hill rta: Nah mate. Not using JSP. In this case Im actually traversing an xhtml DOM and doing a getProperty() to get values when I encounter input elements (etc...) based on the name attribute and using the result to set the value attribute. (or checked attribute or... whatever... for that type of field) And you sad you need an answer for a yesno question! :) Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils] Copy Map to Bean containing nested beans
oh, just ignore!!! i got my answer ;-) rgds navjot singh |-Original Message- |From: Navjot Singh [mailto:[EMAIL PROTECTED] |Sent: Wednesday, June 11, 2003 4:50 PM |To: Struts Users Mailing List |Subject: [OT: BeanUtils] Copy Map to Bean containing nested beans | | |Hi, | |I have this object conversion problem. | |Say I have 2 classes | |Person |- String name |- String age |- Address addr | |Address |- String street |- Strinc city | |I have Map that has following keys |name |age |addr.street |addr.city | |Can we fill my Person object from Map? | |Any help is appreciated. |--- |regards |Navjot Singh | | |- |To unsubscribe, e-mail: [EMAIL PROTECTED] |For additional commands, e-mail: [EMAIL PROTECTED] | | - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils ArrayIndexOutOfBoundsException on session timeout of form submit.
Handle the session time out with a filter? -Original Message- From: Ka-Wai Chan [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 4:26 PM To: [EMAIL PROTECTED] Subject: BeanUtils ArrayIndexOutOfBoundsException on session timeout of form submit. Hello I currently have arrays of objects in my Session Form object which gets populated by struts. All is fine except when the session times out, Struts still wants to populate the arrays but can't because they aren't initialized to the right size anymore. And the place where I handle session time out (BaseAction) is called after this happens. Any suggestions on how to intercept this? Do I have to extend the controller servlet? Thanks Ka-Wai Here is the stack trace: java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.set(Native Method) at org.apache.commons.beanutils.PropertyUtils.setIndexedProperty( PropertyUtils.java:1468) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:918) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:729) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097) at org.apache.struts.action.RequestProcessor.processPopulate(Requ estProcessor.java:798) at org.apache.struts.action.RequestProcessor.process(RequestProce ssor.java:254) at org.apache.struts.action.ActionServlet.process(ActionServlet.j ava:1422) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilt er(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli cationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardW rapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipel ine.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardC ontextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipel ine.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContex t.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHost Valve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDi spatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport Valve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipel ine.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEn gineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValv eContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipel ine.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter. java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Process or.java:594) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle r.processConnection(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi nt.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run( ThreadPool.java:619) at java.lang.Thread.run(Thread.java:479) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BeanUtils question with DynaForms?
[EMAIL PROTECTED] írta: Can I use BeanUtils to convert a DynaForm to a concrete DTO that I have? The signiture matches the names in the DynaForm aside from the Sentance Case. So, I have an element in the struts-config.xml called firstName, and a UserDto that has a setFirstName(String firstName) yes. If conversion errors happen register a new converter w/ ConvertUtils. Hth, Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils question with DynaForms?
Well, I guess the Reflection methods I created were a futile tutorial then. They work pretty good though. _ Thank You Mick Knutson Sr. Designer - Project Trust aUBS AG, Financial - Zürich Office: +41 (0)1/234.42.75 Internal: 48194 Mobile: 079.726.14.26 _ -Original Message- From: Gemes Tibor [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 2:19 PM To: Struts Users Mailing List Subject: Re: BeanUtils question with DynaForms? [EMAIL PROTECTED] írta: Can I use BeanUtils to convert a DynaForm to a concrete DTO that I have? The signiture matches the names in the DynaForm aside from the Sentance Case. So, I have an element in the struts-config.xml called firstName, and a UserDto that has a setFirstName(String firstName) yes. If conversion errors happen register a new converter w/ ConvertUtils. Hth, Tib - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BeanUtils question with DynaForms?
Well, you can copy and convert the *properties* of your DynaActionForm. Try BeanUtils.copyProperties(dao, form). Quoting [EMAIL PROTECTED]: Can I use BeanUtils to convert a DynaForm to a concrete DTO that I have? The signiture matches the names in the DynaForm aside from the Sentance Case. So, I have an element in the struts-config.xml called firstName, and a UserDto that has a setFirstName(String firstName) Thanks in advance... _ Thank You Mick Knutson Sr. Designer - Project Trust aUBS AG, Financial - Zürich Office: +41 (0)1/234.42.75 Internal: 48194 Mobile: 079.726.14.26 _ Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils question with DynaForms?
I was actually wondering if it would work both ways: BeanUtils.copyProperties(dto, dynaForm) BeanUtils.copyProperties(dynaForm, dto) Should work both ways like this yes? _ Thank You Mick Knutson Sr. Designer - Project Trust aUBS AG, Financial - Zürich Office: +41 (0)1/234.42.75 Internal: 48194 Mobile: 079.726.14.26 _ -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 3:06 PM To: Struts Users Mailing List Subject: Re: BeanUtils question with DynaForms? Well, you can copy and convert the *properties* of your DynaActionForm. Try BeanUtils.copyProperties(dao, form). Quoting [EMAIL PROTECTED]: Can I use BeanUtils to convert a DynaForm to a concrete DTO that I have? The signiture matches the names in the DynaForm aside from the Sentance Case. So, I have an element in the struts-config.xml called firstName, and a UserDto that has a setFirstName(String firstName) Thanks in advance... _ Thank You Mick Knutson Sr. Designer - Project Trust aUBS AG, Financial - Zürich Office: +41 (0)1/234.42.75 Internal: 48194 Mobile: 079.726.14.26 _ Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: BeanUtils question with DynaForms?
Yup. Quoting [EMAIL PROTECTED]: I was actually wondering if it would work both ways: BeanUtils.copyProperties(dto, dynaForm) BeanUtils.copyProperties(dynaForm, dto) Should work both ways like this yes? _ Thank You Mick Knutson Sr. Designer - Project Trust aUBS AG, Financial - Zürich Office: +41 (0)1/234.42.75 Internal: 48194 Mobile: 079.726.14.26 _ -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 3:06 PM To: Struts Users Mailing List Subject: Re: BeanUtils question with DynaForms? Well, you can copy and convert the *properties* of your DynaActionForm. Try BeanUtils.copyProperties(dao, form). Quoting [EMAIL PROTECTED]: Can I use BeanUtils to convert a DynaForm to a concrete DTO that I have? The signiture matches the names in the DynaForm aside from the Sentance Case. So, I have an element in the struts-config.xml called firstName, and a UserDto that has a setFirstName(String firstName) Thanks in advance... _ Thank You Mick Knutson Sr. Designer - Project Trust aUBS AG, Financial - Zürich Office: +41 (0)1/234.42.75 Internal: 48194 Mobile: 079.726.14.26 _ Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: beanutils populate problem with formbeans and vectors
(); } catch( Exception x ) { x.printStackTrace(); } } return this.get( index ); } public Object set( int index, Object value ) { System.out.println(public Object set( int index, Object value ): +index); int size = this.size(); if( index = size ) { // Be sure to have enough elements in the vector for( int i = size; i = index; i++ ) { try { this.add( contentClass.newInstance() ); } catch( Exception x ) { x.printStackTrace(); } } } // Call set from java.util.vector to set the element return super.set( index, value ); } private Class contentClass; } an example jsp code: logic:iterate id=dayBeanList indexId=listIdx name=timeProofForm prope rty=dayBeanList td align=center bgcolor=#8DBBE6 a class=bean:write name=dayBeanList property=cssClass/ href=projekterfassung.do?day=bean:write name=dayBeanList property=parameter/ bean:write name=dayBeanList property=date//a /td /logic:iterate can you find the error I get? Thanks Michael -- Fehlerfreie Software wirkt weniger komplex und diskreditiert damit den Entwickler! - Original Message - From: Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, December 18, 2002 7:38 PM Subject: RE: beanutils populate problem with formbeans and vectors Michael, The problem is that the get method is being called when your Collection is empty. This is causing the ArrayIndexOutOfBounds exception that you are seeing. What I have done to prevent this problem is to code my getX(int index) and set(int index, Object obj) methods like this: public Object getMyVector(int index) { if (index = myVector.size()) return ; return myVector.get(index); } public void setMyVector(int index, Object value) { int size=myVector.size(); if (index = size) { for(int i=size; i=index; i++) { myVector.add(); } } myVector.set(index,value); } For the get method, I just return an empty string if the index is bigger than the current size of the vector. For the set method, I increase the size of the vector up to the index if the current size is smaller, otherwise I just set the value that the index points to. This alleviates the need to pre-fill the Vector in the constructor. This solution also works with indexed properties in an html form too. Regards, Richard -Original Message- From: Michael Olszynski [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, December 18, 2002 9:08 AM To: 'Struts Users Mailing List' Subject: beanutils populate problem with formbeans and vectors Hi, I´ve always get an Exception, when I try to change my scope in the struts-config.xml from session to request. I think the problem is that I have a getter and setter for a vector in my formbean. Everything works well with the scope session. My formbean is also working if i completly remove the getter/setter vector out of my bean and my jsp´s. But I´d like to use a bean in a scope session with a getter/setter for vectors. Anybody has a clue about this problem. I read some things in the mailarchive, but that didn´t help me. This is the error: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:980) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor .java:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:24 6) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicati onFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter Chain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve. java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480 ) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve. java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:643) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java :246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv
RE: beanutils populate problem with formbeans and vectors
Es kommt von Ihrer eigenen Anwendung! -- James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg. - Bjarne Stroustrup -Original Message- From: Michael Olszynski [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 11:38 AM To: Struts Users Mailing List Subject: Re: beanutils populate problem with formbeans and vectors Does anybody have an idea, where this exception is from. I´m still working on it.. Thaks a lot, Michael -- Fehlerfreie Software wirkt weniger komplex und diskreditiert damit den Entwickler! - Original Message - From: Michael Olszynski [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 11:48 AM Subject: Re: beanutils populate problem with formbeans and vectors Hi Richard, thanks for your help. I tried what u wrote me, but it didn´t work. I get following exception: 11:36:32,775 ERROR [Engine] ApplicationDispatcher[/Zeiterfassung_Applikation] Se rvlet.service() for servlet jsp threw exception org.apache.jasper.JasperException at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2 89) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD ispatcher.java:575) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis patcher.java:498) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary .java:820) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.jav a:395) at org.apache.struts.taglib.template.GetTag.doStartTag(GetTag.java:191) at org.apache.jsp.template_jsp._jspx_meth_template_get_4(template_jsp.ja va:221) at org.apache.jsp.template_jsp._jspx_meth_html_html_0(template_jsp.java: 118) at org.apache.jsp.template_jsp._jspService(template_jsp.java:62) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2 89) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD ispatcher.java:575) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis patcher.java:498) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary .java:820) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.jav a:395) at org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:1 55) at org.apache.jsp.index_jsp._jspx_meth_template_insert_0(index_jsp.java: 108) at org.apache.jsp.index_jsp._jspService(index_jsp.java:71) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2 89) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:684) ** ** ** Here ist the Code I wrote: FormBean: public class TimeProofFormBean extends ActionForm { public FormBeanVector getTimeProofList() { return this.timeProofList; } public void setTimeProofList( Vector v ) { this.timeProofList = new FormBeanVector ( TimeProofTableBean.class, v); } public FormBeanVector getDayBeanList() { return this.dayBeanList; } public void setDayBeanList( Vector v ) { this.dayBeanList = new
Re: beanutils populate problem with formbeans and vectors
Could u specify this more? Where is the error in my application? I attached a tiny piece of sample code in my mail (if you scroll down). We (two guys) are looking to find this error for over 6 hours now. Thanks a lot! -- Fehlerfreie Software wirkt weniger komplex und diskreditiert damit den Entwickler! - Original Message - From: James Mitchell [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 5:49 PM Subject: RE: beanutils populate problem with formbeans and vectors Es kommt von Ihrer eigenen Anwendung! -- James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg. - Bjarne Stroustrup -Original Message- From: Michael Olszynski [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 11:38 AM To: Struts Users Mailing List Subject: Re: beanutils populate problem with formbeans and vectors Does anybody have an idea, where this exception is from. I´m still working on it.. Thaks a lot, Michael -- Fehlerfreie Software wirkt weniger komplex und diskreditiert damit den Entwickler! - Original Message - From: Michael Olszynski [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 11:48 AM Subject: Re: beanutils populate problem with formbeans and vectors Hi Richard, thanks for your help. I tried what u wrote me, but it didn´t work. I get following exception: 11:36:32,775 ERROR [Engine] ApplicationDispatcher[/Zeiterfassung_Applikation] Se rvlet.service() for servlet jsp threw exception org.apache.jasper.JasperException at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:248) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2 89) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD ispatcher.java:575) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis patcher.java:498) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary .java:820) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.jav a:395) at org.apache.struts.taglib.template.GetTag.doStartTag(GetTag.java:191) at org.apache.jsp.template_jsp._jspx_meth_template_get_4(template_jsp.ja va:221) at org.apache.jsp.template_jsp._jspx_meth_html_html_0(template_jsp.java: 118) at org.apache.jsp.template_jsp._jspService(template_jsp.java:62) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2 89) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD ispatcher.java:575) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis patcher.java:498) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary .java:820) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.jav a:395) at org.apache.struts.taglib.template.InsertTag.doEndTag(InsertTag.java:1 55) at org.apache.jsp.index_jsp._jspx_meth_template_insert_0(index_jsp.java: 108) at org.apache.jsp.index_jsp._jspService(index_jsp.java:71) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper .java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2 89) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:684) ** ** ** Here ist the Code I wrote: FormBean: public
RE: beanutils populate problem with formbeans and vectors
Michael, The problem is that the get method is being called when your Collection is empty. This is causing the ArrayIndexOutOfBounds exception that you are seeing. What I have done to prevent this problem is to code my getX(int index) and set(int index, Object obj) methods like this: public Object getMyVector(int index) { if (index = myVector.size()) return ; return myVector.get(index); } public void setMyVector(int index, Object value) { int size=myVector.size(); if (index = size) { for(int i=size; i=index; i++) { myVector.add(); } } myVector.set(index,value); } For the get method, I just return an empty string if the index is bigger than the current size of the vector. For the set method, I increase the size of the vector up to the index if the current size is smaller, otherwise I just set the value that the index points to. This alleviates the need to pre-fill the Vector in the constructor. This solution also works with indexed properties in an html form too. Regards, Richard -Original Message- From: Michael Olszynski [SMTP:[EMAIL PROTECTED]] Sent: Wednesday, December 18, 2002 9:08 AM To: 'Struts Users Mailing List' Subject: beanutils populate problem with formbeans and vectors Hi, I´ve always get an Exception, when I try to change my scope in the struts-config.xml from session to request. I think the problem is that I have a getter and setter for a vector in my formbean. Everything works well with the scope session. My formbean is also working if i completly remove the getter/setter vector out of my bean and my jsp´s. But I´d like to use a bean in a scope session with a getter/setter for vectors. Anybody has a clue about this problem. I read some things in the mailarchive, but that didn´t help me. This is the error: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:980) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor .java:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:24 6) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicati onFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter Chain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve. java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480 ) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve. java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:643) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java :246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480 ) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:1 80) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValv e.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1 72) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:641) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv okeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480 ) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.ja va:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.inv
RE: BeanUtils getPropertyDescriptor error
The answer to both the questions is yes. Thanks for the re-assurance. Dan -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: 04 October 2002 17:37 To: Struts Users Mailing List Subject: Re: BeanUtils getPropertyDescriptor error On Fri, 4 Oct 2002, Daniel Haynes wrote: Date: Fri, 4 Oct 2002 10:06:42 +0100 From: Daniel Haynes [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts-User (E-mail) [EMAIL PROTECTED] Subject: BeanUtils getPropertyDescriptor error Hi, Having gone live with our webapp (and changed the logging) an error stated to appear in our logs. However the app is functioning fine. Is this error a problem ? The error occurs with submitions from jsps which contain radio buttons. In our action class we extract the request parameters to establish the state(s) of the radio buttons to process the request. Is all this ok or am I missing something here ? Is this happening during the population of the form bean (which Struts does for you)? Do the exception messages show up only in the debug messages, and not cause problems in your application itself? If the answer to both questions is yes, then this is harmless. The BeanUtils.populate() method operates like this: - Iterate over the keys in the Map that is passed in (i.e. over the names of all request parameters included in the request) - If there is a matching property on the destination bean, do the appropriate set - If there is no matching property on the destination bean, ignore this request parameter The exception is being triggered by the getPropertyDescriptor() call used to test the third condition. Craig (We are using Struts 1.1) 2002-10-03 17:03:35,765 DEBUG [BeanUtils] BeanUtils.populate(com.rule.approve.ApproveForm@c18e99, {detailsList[5].qualityID=[Ljava.lang.String;@fba68, detailsList[10].qualityID=[Ljava.lang.String;@970991, detailsList[6].qualityID=[Ljava.lang.String;@f53870, detailsList[11].qualityID=[Ljava.lang.String;@4c4ac9, detailsList[7].qualityID=[Ljava.lang.String;@c1e333, detailsList[8].qualityID=[Ljava.lang.String;@2b3574, detailsList[9].qualityID=[Ljava.lang.String;@c27081, action=[Ljava.lang.String;@685be9, detailsList[0].qualityID=[Ljava.lang.String;@6a1fbe, detailsList[1].qualityID=[Ljava.lang.String;@4a0fe1, detailsList[2].qualityID=[Ljava.lang.String;@589d3d, detailsList[3].qualityID=[Ljava.lang.String;@bb1bc4, detailsList[4].qualityID=[Ljava.lang.String;@1bfefb}) 2002-10-03 17:03:35,765 DEBUG [BeanUtils] name='detailsList[5].qualityID', value.class='[Ljava.lang.String;', value='[Ljava.lang.String;@fba68' 2002-10-03 17:03:35,781 DEBUG [BeanUtils] getPropertyDescriptor java.lang.NoSuchMethodException: Unknown property 'detailsList' at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:416) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:363) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUti ls.java:770) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:501) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:952) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:795) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:244) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at com.rule.common.filters.TimerFilter.doFilter(TimerFilter.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase .java:528) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64
Re: BeanUtils getPropertyDescriptor error
On Fri, 4 Oct 2002, Daniel Haynes wrote: Date: Fri, 4 Oct 2002 10:06:42 +0100 From: Daniel Haynes [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts-User (E-mail) [EMAIL PROTECTED] Subject: BeanUtils getPropertyDescriptor error Hi, Having gone live with our webapp (and changed the logging) an error stated to appear in our logs. However the app is functioning fine. Is this error a problem ? The error occurs with submitions from jsps which contain radio buttons. In our action class we extract the request parameters to establish the state(s) of the radio buttons to process the request. Is all this ok or am I missing something here ? Is this happening during the population of the form bean (which Struts does for you)? Do the exception messages show up only in the debug messages, and not cause problems in your application itself? If the answer to both questions is yes, then this is harmless. The BeanUtils.populate() method operates like this: - Iterate over the keys in the Map that is passed in (i.e. over the names of all request parameters included in the request) - If there is a matching property on the destination bean, do the appropriate set - If there is no matching property on the destination bean, ignore this request parameter The exception is being triggered by the getPropertyDescriptor() call used to test the third condition. Craig (We are using Struts 1.1) 2002-10-03 17:03:35,765 DEBUG [BeanUtils] BeanUtils.populate(com.rule.approve.ApproveForm@c18e99, {detailsList[5].qualityID=[Ljava.lang.String;@fba68, detailsList[10].qualityID=[Ljava.lang.String;@970991, detailsList[6].qualityID=[Ljava.lang.String;@f53870, detailsList[11].qualityID=[Ljava.lang.String;@4c4ac9, detailsList[7].qualityID=[Ljava.lang.String;@c1e333, detailsList[8].qualityID=[Ljava.lang.String;@2b3574, detailsList[9].qualityID=[Ljava.lang.String;@c27081, action=[Ljava.lang.String;@685be9, detailsList[0].qualityID=[Ljava.lang.String;@6a1fbe, detailsList[1].qualityID=[Ljava.lang.String;@4a0fe1, detailsList[2].qualityID=[Ljava.lang.String;@589d3d, detailsList[3].qualityID=[Ljava.lang.String;@bb1bc4, detailsList[4].qualityID=[Ljava.lang.String;@1bfefb}) 2002-10-03 17:03:35,765 DEBUG [BeanUtils] name='detailsList[5].qualityID', value.class='[Ljava.lang.String;', value='[Ljava.lang.String;@fba68' 2002-10-03 17:03:35,781 DEBUG [BeanUtils] getPropertyDescriptor java.lang.NoSuchMethodException: Unknown property 'detailsList' at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:416) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils. java:363) at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUti ls.java:770) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:501) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:952) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j ava:795) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:244) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at com.rule.common.filters.TimerFilter.doFilter(TimerFilter.java:36) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:213) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase .java:528) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2 46) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 64) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
Re: BeanUtils Question
On Thu, 19 Sep 2002, Darren Hill wrote: Date: Thu, 19 Sep 2002 09:21:12 -0400 From: Darren Hill [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: BeanUtils Question Not sure if this is the write forum for this.. anyway. An alternative would be the COMMONS-USER list, but many Struts folks use this library as well. I have a Stateless Session Bean that acts as my Service Layer in my App. ( It seperates my Domain Layer[EJB's] from my App Layer [Actions/Views] ) My 'views' are simply beans the duplicate the EJB's. I want to use the BeanUtils.copyProperties to populate the 'view' with the EJB values. But I'm having trouble. It's pretty tough to help without knowing what having trouble means. Are you getting exceptions (if so, what's the stack trace)? Are properties not getting copied? ??? Also ... would it be better to use PropertyUtils.copyProperties since the properties have exactly the same type? PropertyUtils.copyProperties() will be faster than BeanUtils.copyProperties() because it won't waste time trying to figure out what conversions are necessary. Therefore, you should use the PropertyUtils version when you can (i.e. when all the property types match). Sorry if that is very clear .. its my first time using this .. be gentle. Darren. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: BeanUtils
concerning my own question: so far i realized that it has to do with my mapping somehow. before i had mapped *.do to my actionservlet and then images/someimg.gif worked and now, as i switched over to use /do/ for mapping, it doesn't work anymore with images/someimg.gif and i have to use MyApp/images/someimg.gif... any ideas, suggestions? thanks! _ Mit MSN Fotos können Sie kinderleicht Ihre Fotos ausdrucken und Freunden zur Verfügung stellen: http://photos.msn.de -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: BeanUtils
JavaBeans indexed properties (which BeanUtils uses under the covers) only support array based properties for indexed storage. BeanUtils was extended fairly recently to do better with Lists. If you have a particular test case that doesn't work, please post it as an attachment to a bug report against BeanUtils: http://nagoya.apache.org/bugzilla/ Craig On Mon, 26 Aug 2002, petra staub wrote: Date: Mon, 26 Aug 2002 11:59:47 +0200 From: petra staub [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: BeanUtils hi, I know this is a struts-maillist but as the beanutils are commonly used with struts (and I didnt get any feedback in the commons-user list) I dare to ask my question here. :) i recently came over the very useful classes of the BeanUtils package. however, i have some problems... for testing, i simply wanted to use the copyProperties method to populate the values of one object to an other (empty) object. i created a class with different properties (int, float, String, Hashtable, Vector) and the corresponding getters/ setters. everything worked fine (the values were copied :) ) except for the Vector which gave me an error: Error in PropertyUtils.copyProperties(): Property vecElem has no getter method however, I have a method public Vector getVecElem() and even (for other usage) public Object getVecElem(int idx). I also tried to used the ArrayList instead of a Vector what helps to get rid of the error message, however, the values are not copied. Are Lists not supported with the BeanUtils? Am I simply doing something wrong? Maybe someone can help me newbie... Thanks a lot! _ Mit MSN Fotos können Sie kinderleicht Ihre Fotos ausdrucken und Freunden zur Verfügung stellen: http://photos.msn.de -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: BeanUtils
In looking over the current release notes for the BeanUtils in the commons project, I can across the following bug report list: BUG REPORTS ADDRESSED: = 4895 Populate method doesn't work for an indexed setter for arrays 6125 Populate method has mistaken the judgement which uses indexed property 6465 Wrong method BeanUtils.populate(), so that in Struts indexed multiselects not work Jerome Jacobsen [EMAIL PROTECTED] on 05/30/2002 01:55:54 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] cc:(bcc: Kevin Bedell/Systems/USHO/SunLife) Subject: RE: BeanUtils I'm also having trouble concerning indexed properties with BeanUtils. If the type of the indexed property is String, then BeanUtils.populate throws IllegalArgumentException. Using your NameBean in an example: ... NameBean nameBean = new NameBean(); BeanUtils.populate(nameBean,new String[] {John, Paul, Jack}); // above throws IllegalArgumentException! ... If I take the same indexed property and change it to an int BeanUtils.populate works! I've posted this problem to both the jakarta-commons-dev and struts-user lists with no response. So I don't know if it is supported or not. Please, can someone give us an answer??? -Original Message- From: Filipe Mateus [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 1:30 PM To: [EMAIL PROTECTED] Subject: BeanUtils Do BeanUtils.describe and BeanUtils.populate supposed to handle indexed properties? Suppose I have this JavaBean: public class NameBean { private String[] name; public String[] getName() { return this.name; } public void setName(String[] name) { this.name = name; } public String getName(int index) { return this.name[index]; } public void setName(int index, String name) { this.name[index] = name; } } I would expect the following code to return a Map containing: name[0]=John, name[1]=Paul, name[2]=Jack but instead, I get name=John. Only the first element is considered. ... NameBean nameBean = new NameBean(); nameBean.setName(new String[] {John, Paul, Jack}); Map properties = BeanUtils.describe(nameBean); ... ** Financiere Banque Nationale et NBCN n'assument aucune responsabilite quant a la confidentialite et l'integrite du present courriel en raison des risques d'interception inherents a l'Internet. Pour cette raison, toute opinion exprimee au terme des presentes ne reflete pas necessairement celle de Financiere Banque Nationale et de NBCN. ** Due to the security risks involved in sending information over the Internet, National Bank Financial and NBCN cannot be held responsible for ensuring the confidentiality and integrity of the present e-mail. For this reason, the opinions expressed herein do not necessarily reflect those of National Bank Financial and NBCN. ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] --- This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender and erase this e-mail message immediately. --- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: BeanUtils
I saw that too. They are in the 1.3 RELNOTES. But the problem shows up in 1.3. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 3:26 PM To: Struts Users Mailing List Subject: RE: BeanUtils In looking over the current release notes for the BeanUtils in the commons project, I can across the following bug report list: BUG REPORTS ADDRESSED: = 4895 Populate method doesn't work for an indexed setter for arrays 6125 Populate method has mistaken the judgement which uses indexed property 6465 Wrong method BeanUtils.populate(), so that in Struts indexed multiselects not work Jerome Jacobsen [EMAIL PROTECTED] on 05/30/2002 01:55:54 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] cc:(bcc: Kevin Bedell/Systems/USHO/SunLife) Subject: RE: BeanUtils I'm also having trouble concerning indexed properties with BeanUtils. If the type of the indexed property is String, then BeanUtils.populate throws IllegalArgumentException. Using your NameBean in an example: ... NameBean nameBean = new NameBean(); BeanUtils.populate(nameBean,new String[] {John, Paul, Jack}); // above throws IllegalArgumentException! ... If I take the same indexed property and change it to an int BeanUtils.populate works! I've posted this problem to both the jakarta-commons-dev and struts-user lists with no response. So I don't know if it is supported or not. Please, can someone give us an answer??? -Original Message- From: Filipe Mateus [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 1:30 PM To: [EMAIL PROTECTED] Subject: BeanUtils Do BeanUtils.describe and BeanUtils.populate supposed to handle indexed properties? Suppose I have this JavaBean: public class NameBean { private String[] name; public String[] getName() { return this.name; } public void setName(String[] name) { this.name = name; } public String getName(int index) { return this.name[index]; } public void setName(int index, String name) { this.name[index] = name; } } I would expect the following code to return a Map containing: name[0]=John, name[1]=Paul, name[2]=Jack but instead, I get name=John. Only the first element is considered. ... NameBean nameBean = new NameBean(); nameBean.setName(new String[] {John, Paul, Jack}); Map properties = BeanUtils.describe(nameBean); ... ** Financiere Banque Nationale et NBCN n'assument aucune responsabilite quant a la confidentialite et l'integrite du present courriel en raison des risques d'interception inherents a l'Internet. Pour cette raison, toute opinion exprimee au terme des presentes ne reflete pas necessairement celle de Financiere Banque Nationale et de NBCN. ** Due to the security risks involved in sending information over the Internet, National Bank Financial and NBCN cannot be held responsible for ensuring the confidentiality and integrity of the present e-mail. For this reason, the opinions expressed herein do not necessarily reflect those of National Bank Financial and NBCN. ** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] --- This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender and erase this e-mail message immediately. --- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: BeanUtils/RequestUtils Populate question
Hi Jon. This would happen if your formbean was in request scope (specified in struts-config.xml), but I wouldn't expect it to happen in session scope. Do you have a reset method defined on the formbean? Could it be causing problems? -- Jim Jon.Ridgway [EMAIL PROTECTED] writes: Hi All, I have a form bean that uses a value object. A specific form only access a couple of the value objects properties. I would expect those not accessed to be left alone upon form submittal. However I am finding that Struts (vi RequestUtils.populate) is setting those fields not referenced in the JSP to null. This doesn't seem right to me, am I missing something? Has anyone else experienced similar problems? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: BeanUtils/RequestUtils Populate question
I think this is right, cause your form on the jsp represents the form bean. So if you miss some data this data is set to null cause the view represantion hasn't included the information -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 4:42 PM To: 'Struts Users Mailing List' Subject: BeanUtils/RequestUtils Populate question Hi All, I have a form bean that uses a value object. A specific form only access a couple of the value objects properties. I would expect those not accessed to be left alone upon form submittal. However I am finding that Struts (vi RequestUtils.populate) is setting those fields not referenced in the JSP to null. This doesn't seem right to me, am I missing something? Has anyone else experienced similar problems? Jon. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: BeanUtils/RequestUtils Populate question
Hi Jim, My form is in request scope. I don't have a reset method defined. If this is expected behavior I would argue strongly that it's wrong, or that you should have the option of overriding it. Jon. -Original Message- From: Jim Crossley [mailto:[EMAIL PROTECTED]] Sent: 02 April 2002 15:50 To: Struts Users Mailing List Subject: Re: BeanUtils/RequestUtils Populate question Hi Jon. This would happen if your formbean was in request scope (specified in struts-config.xml), but I wouldn't expect it to happen in session scope. Do you have a reset method defined on the formbean? Could it be causing problems? -- Jim Jon.Ridgway [EMAIL PROTECTED] writes: Hi All, I have a form bean that uses a value object. A specific form only access a couple of the value objects properties. I would expect those not accessed to be left alone upon form submittal. However I am finding that Struts (vi RequestUtils.populate) is setting those fields not referenced in the JSP to null. This doesn't seem right to me, am I missing something? Has anyone else experienced similar problems? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: BeanUtils/RequestUtils Populate question
Hi Oliver, I don't. If I have a value object in a form bean and I and only wish to alter a couple of its properties how can I do it. It would appear that Struts will set any fields not referenced to null. If a property of the valueObject returns a complex type ie a Map then I can't use the html:hidden work round I'm currently using; so I just have to except that I'll loose my map. Not very acceptable. Jon. -Original Message- From: Oliver Reflé [mailto:[EMAIL PROTECTED]] Sent: 02 April 2002 15:47 To: Struts Users Mailing List Subject: RE: BeanUtils/RequestUtils Populate question I think this is right, cause your form on the jsp represents the form bean. So if you miss some data this data is set to null cause the view represantion hasn't included the information -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 4:42 PM To: 'Struts Users Mailing List' Subject: BeanUtils/RequestUtils Populate question Hi All, I have a form bean that uses a value object. A specific form only access a couple of the value objects properties. I would expect those not accessed to be left alone upon form submittal. However I am finding that Struts (vi RequestUtils.populate) is setting those fields not referenced in the JSP to null. This doesn't seem right to me, am I missing something? Has anyone else experienced similar problems? Jon. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: BeanUtils/RequestUtils Populate question
But on the other side, if you have set the request scope for you form, than the values are set in the preparing action, it is transformed to your jsp and the form on the jsp is filled. then the form object will be deleted cause it was only in the request. So if you submit your form then a new form object is created which will be filled with the entered values. So he is not able to transfer the data between the two form beans. You have to store the missing data manually for using it in the next request. -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 5:08 PM To: 'Struts Users Mailing List' Subject: RE: BeanUtils/RequestUtils Populate question Hi Oliver, I don't. If I have a value object in a form bean and I and only wish to alter a couple of its properties how can I do it. It would appear that Struts will set any fields not referenced to null. If a property of the valueObject returns a complex type ie a Map then I can't use the html:hidden work round I'm currently using; so I just have to except that I'll loose my map. Not very acceptable. Jon. -Original Message- From: Oliver Reflé [mailto:[EMAIL PROTECTED]] Sent: 02 April 2002 15:47 To: Struts Users Mailing List Subject: RE: BeanUtils/RequestUtils Populate question I think this is right, cause your form on the jsp represents the form bean. So if you miss some data this data is set to null cause the view represantion hasn't included the information -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 4:42 PM To: 'Struts Users Mailing List' Subject: BeanUtils/RequestUtils Populate question Hi All, I have a form bean that uses a value object. A specific form only access a couple of the value objects properties. I would expect those not accessed to be left alone upon form submittal. However I am finding that Struts (vi RequestUtils.populate) is setting those fields not referenced in the JSP to null. This doesn't seem right to me, am I missing something? Has anyone else experienced similar problems? Jon. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: BeanUtils/RequestUtils Populate question
Hi Oliver, I see what you mean. Looks like a design floor on my part. I don't wish to put the forms in the session scope as I already have the ValueObjects there. I'll try using the PropertyUtils.copyProperties stuff to transfer back and forth. Thanks for the clarification Jon. -Original Message- From: Oliver Reflé [mailto:[EMAIL PROTECTED]] Sent: 02 April 2002 16:15 To: Struts Users Mailing List Subject: RE: BeanUtils/RequestUtils Populate question But on the other side, if you have set the request scope for you form, than the values are set in the preparing action, it is transformed to your jsp and the form on the jsp is filled. then the form object will be deleted cause it was only in the request. So if you submit your form then a new form object is created which will be filled with the entered values. So he is not able to transfer the data between the two form beans. You have to store the missing data manually for using it in the next request. -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 5:08 PM To: 'Struts Users Mailing List' Subject: RE: BeanUtils/RequestUtils Populate question Hi Oliver, I don't. If I have a value object in a form bean and I and only wish to alter a couple of its properties how can I do it. It would appear that Struts will set any fields not referenced to null. If a property of the valueObject returns a complex type ie a Map then I can't use the html:hidden work round I'm currently using; so I just have to except that I'll loose my map. Not very acceptable. Jon. -Original Message- From: Oliver Reflé [mailto:[EMAIL PROTECTED]] Sent: 02 April 2002 15:47 To: Struts Users Mailing List Subject: RE: BeanUtils/RequestUtils Populate question I think this is right, cause your form on the jsp represents the form bean. So if you miss some data this data is set to null cause the view represantion hasn't included the information -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 4:42 PM To: 'Struts Users Mailing List' Subject: BeanUtils/RequestUtils Populate question Hi All, I have a form bean that uses a value object. A specific form only access a couple of the value objects properties. I would expect those not accessed to be left alone upon form submittal. However I am finding that Struts (vi RequestUtils.populate) is setting those fields not referenced in the JSP to null. This doesn't seem right to me, am I missing something? Has anyone else experienced similar problems? Jon. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: BeanUtils deprecated?
Sorry... just tired... from javadocs: At some point after Struts 1.0 final, will be replaced by an equivalent class in the Jakarta Commons Beanutils package. -Original Message- From: Paradis, André Sent: September 5, 2001 3:52 PM To: [EMAIL PROTECTED] Subject: BeanUtils deprecated? Hi guys, This has probably been answered before, BeanUtils is deprecated (struts 1.0). What is the correct alternative to this class? Thanks a lot, Andre Paradis