Re: How to get the size of a java.util.List object in EL?
Adam, JSP 2.0 introduces the notion of functions within EL, and in step with that release, JSTL 1.1 will include some standard functions including size. There are early releases like Tomcat 5.0 and Resin 3.0 that give you some features of JSP 2.0, although I haven't tried either. Hopefully the specs will get finalized to get these standards out there soon. -- Serge Knystautas President Lokitech >> software . strategy . design >> http://www.lokitech.com p. 301.656.5501 e. [EMAIL PROTECTED] Adam Hardy wrote: Hi Billy, I don't know about this one. Maybe someone more guru-like will step up with an answer 8-) I'm not quite sure why EL doesn't like this but I think it's because the List class is not a javabean - presumably EL looks for getSize() rather than the actual size(), but that doesn't explain why it's complaining about an integer. Adam On 09/17/2003 02:19 AM Billy Bacon wrote: I need to get the size (as an int) of a java.util.List I have. The following doesn't work It gives me the following exception... ServletException in:/jsp/browseQueueBody.jsp] An error occurred while evaluating custom action attribute "value" with value "Size = ${browseForm.map.colInfoList.size}": The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer. (null)' Does anyone know how I could get the size of the List? - Billy - - 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: How to get the size of a java.util.List object in EL?
Well, since we're getting into terrible hacks territory, how about: :) On 09/17/2003 02:05 PM Martin van Dijken wrote: Oops, Guess I spoke a little too fast there. The count does not, like I thought, expose the list size, but the count of how many iterations have passed. Sorry, no go, Martin -Original Message- From: Martin van Dijken Sent: woensdag 17 september 2003 14:02 To: Tag Libraries Users List Subject: RE: How to get the size of a java.util.List object in EL? Hey guys, I think this can be accomplished although not directly. I must admit it's a terrible hack, so decide for yourself if you want to use this. I don't exactly have a test situation, so I can't really test this, but try: This only shows the count if there is at least one item in your list, but I think you can check for yourself whether something was printed. Greetz, Martin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: woensdag 17 september 2003 13:53 To: [EMAIL PROTECTED] Subject: RE: How to get the size of a java.util.List object in EL? Hi guys I think this has been discussed in this list about 3.7 million times, so check out the archives... The short answer is: You can't. Best regards, Eric -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Mittwoch, 17. September 2003 13:39 To: Tag Libraries Users List Subject: Re: How to get the size of a java.util.List object in EL? Hi Billy, I don't know about this one. Maybe someone more guru-like will step up with an answer 8-) I'm not quite sure why EL doesn't like this but I think it's because the List class is not a javabean - presumably EL looks for getSize() rather than the actual size(), but that doesn't explain why it's complaining about an integer. Adam On 09/17/2003 02:19 AM Billy Bacon wrote: I need to get the size (as an int) of a java.util.List I have. The following doesn't work It gives me the following exception... ServletException in:/jsp/browseQueueBody.jsp] An error occurred while evaluating custom action attribute "value" with value "Size = ${browseForm.map.colInfoList.size}": The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer. (null)' Does anyone know how I could get the size of the List? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to get the size of a java.util.List object in EL?
Oops, Guess I spoke a little too fast there. The count does not, like I thought, expose the list size, but the count of how many iterations have passed. Sorry, no go, Martin > -Original Message- > From: Martin van Dijken > Sent: woensdag 17 september 2003 14:02 > To: Tag Libraries Users List > Subject: RE: How to get the size of a java.util.List object in EL? > > > Hey guys, > > > I think this can be accomplished although not directly. I > must admit it's a terrible hack, so decide for yourself if > you want to use this. I don't exactly have a test situation, > so I can't really test this, but try: > > end="0" varStatus="status"> > > > > This only shows the count if there is at least one item in > your list, but I think you can check for yourself whether > something was printed. > > Greetz, > > Martin > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: woensdag 17 september 2003 13:53 > > To: [EMAIL PROTECTED] > > Subject: RE: How to get the size of a java.util.List object in EL? > > > > > > Hi guys > > > > I think this has been discussed in this list about 3.7 > > million times, so > > check out the archives... > > The short answer is: You can't. > > > > Best regards, > > Eric > > > > -Original Message- > > From: Adam Hardy [mailto:[EMAIL PROTECTED] > > Sent: Mittwoch, 17. September 2003 13:39 > > To: Tag Libraries Users List > > Subject: Re: How to get the size of a java.util.List object in EL? > > > > > > Hi Billy, > > > > I don't know about this one. Maybe someone more guru-like > > will step up > > with an answer 8-) > > > > I'm not quite sure why EL doesn't like this but I think it's > > because the > > List class is not a javabean - presumably EL looks for > > getSize() rather > > than the actual size(), but that doesn't explain why it's > complaining > > about an integer. > > > > > > Adam > > > > > > On 09/17/2003 02:19 AM Billy Bacon wrote: > > > I need to get the size (as an int) of a java.util.List I have. The > > following > > > doesn't work > > > > > > > > > > > > It gives me the following exception... > > > > > > ServletException in:/jsp/browseQueueBody.jsp] An error > > occurred while > > > evaluating custom action attribute "value" with value "Size = > > > ${browseForm.map.colInfoList.size}": The "." operator was > > supplied with an > > > index value of type "java.lang.String" to be applied to a > > List or array, > > but > > > that value cannot be converted to an integer. (null)' > > > > > > Does anyone know how I could get the size of the List? > > > > > > - Billy - > > > > > > > > > > > > - > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > -- > > struts 1.1 + tomcat 4.1.27 + java 1.4.2 > > Linux 2.4.20 RH9 > > > > > > > - > > 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] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to get the size of a java.util.List object in EL?
Hey guys, I think this can be accomplished although not directly. I must admit it's a terrible hack, so decide for yourself if you want to use this. I don't exactly have a test situation, so I can't really test this, but try: This only shows the count if there is at least one item in your list, but I think you can check for yourself whether something was printed. Greetz, Martin > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: woensdag 17 september 2003 13:53 > To: [EMAIL PROTECTED] > Subject: RE: How to get the size of a java.util.List object in EL? > > > Hi guys > > I think this has been discussed in this list about 3.7 > million times, so > check out the archives... > The short answer is: You can't. > > Best regards, > Eric > > -Original Message- > From: Adam Hardy [mailto:[EMAIL PROTECTED] > Sent: Mittwoch, 17. September 2003 13:39 > To: Tag Libraries Users List > Subject: Re: How to get the size of a java.util.List object in EL? > > > Hi Billy, > > I don't know about this one. Maybe someone more guru-like > will step up > with an answer 8-) > > I'm not quite sure why EL doesn't like this but I think it's > because the > List class is not a javabean - presumably EL looks for > getSize() rather > than the actual size(), but that doesn't explain why it's complaining > about an integer. > > > Adam > > > On 09/17/2003 02:19 AM Billy Bacon wrote: > > I need to get the size (as an int) of a java.util.List I have. The > following > > doesn't work > > > > > > > > It gives me the following exception... > > > > ServletException in:/jsp/browseQueueBody.jsp] An error > occurred while > > evaluating custom action attribute "value" with value "Size = > > ${browseForm.map.colInfoList.size}": The "." operator was > supplied with an > > index value of type "java.lang.String" to be applied to a > List or array, > but > > that value cannot be converted to an integer. (null)' > > > > Does anyone know how I could get the size of the List? > > > > - Billy - > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > -- > struts 1.1 + tomcat 4.1.27 + java 1.4.2 > Linux 2.4.20 RH9 > > > - > 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: How to get the size of a java.util.List object in EL?
Hi guys I think this has been discussed in this list about 3.7 million times, so check out the archives... The short answer is: You can't. Best regards, Eric -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Mittwoch, 17. September 2003 13:39 To: Tag Libraries Users List Subject: Re: How to get the size of a java.util.List object in EL? Hi Billy, I don't know about this one. Maybe someone more guru-like will step up with an answer 8-) I'm not quite sure why EL doesn't like this but I think it's because the List class is not a javabean - presumably EL looks for getSize() rather than the actual size(), but that doesn't explain why it's complaining about an integer. Adam On 09/17/2003 02:19 AM Billy Bacon wrote: > I need to get the size (as an int) of a java.util.List I have. The following > doesn't work > > > > It gives me the following exception... > > ServletException in:/jsp/browseQueueBody.jsp] An error occurred while > evaluating custom action attribute "value" with value "Size = > ${browseForm.map.colInfoList.size}": The "." operator was supplied with an > index value of type "java.lang.String" to be applied to a List or array, but > that value cannot be converted to an integer. (null)' > > Does anyone know how I could get the size of the List? > > - Billy - > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - 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: How to get the size of a java.util.List object in EL?
This has been on the list before I think. The recommended solution appears to be to replace your List class with a ListBean which contains a getSize method. Would probably be useful if Taglib project could have these classes available for download. Anyone implemented these and feel like offering them up? Another option is to have a tag to get it. Maybe Xephyrus could add it to their datastruct taglib: http://www.xephyrus.com/taglib-datastructs/reference.html Hen On Wed, 17 Sep 2003, Adam Hardy wrote: > Hi Billy, > > I don't know about this one. Maybe someone more guru-like will step up > with an answer 8-) > > I'm not quite sure why EL doesn't like this but I think it's because the > List class is not a javabean - presumably EL looks for getSize() rather > than the actual size(), but that doesn't explain why it's complaining > about an integer. > > > Adam > > > On 09/17/2003 02:19 AM Billy Bacon wrote: > > I need to get the size (as an int) of a java.util.List I have. The following > > doesn't work > > > > > > > > It gives me the following exception... > > > > ServletException in:/jsp/browseQueueBody.jsp] An error occurred while > > evaluating custom action attribute "value" with value "Size = > > ${browseForm.map.colInfoList.size}": The "." operator was supplied with an > > index value of type "java.lang.String" to be applied to a List or array, but > > that value cannot be converted to an integer. (null)' > > > > Does anyone know how I could get the size of the List? > > > > - Billy - > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- > struts 1.1 + tomcat 4.1.27 + java 1.4.2 > Linux 2.4.20 RH9 > > > - > 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: How to get the size of a java.util.List object in EL?
Hi Billy, I don't know about this one. Maybe someone more guru-like will step up with an answer 8-) I'm not quite sure why EL doesn't like this but I think it's because the List class is not a javabean - presumably EL looks for getSize() rather than the actual size(), but that doesn't explain why it's complaining about an integer. Adam On 09/17/2003 02:19 AM Billy Bacon wrote: I need to get the size (as an int) of a java.util.List I have. The following doesn't work It gives me the following exception... ServletException in:/jsp/browseQueueBody.jsp] An error occurred while evaluating custom action attribute "value" with value "Size = ${browseForm.map.colInfoList.size}": The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer. (null)' Does anyone know how I could get the size of the List? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]