RE: Iterating over collections with null values

2001-03-05 Thread Howard Moore

I prefer (3) because it makes the loop behave in exactly the same way as it
would in any other language. 

I don't like (2) at all because it removes information (the null values)
that is likely to have been included in the collection for a reason. Also,
if the iterate tag is ever extended to support ResultSets it is almost
inevitably going to have to handle null values.



 -Original Message-
 From: Nick Pellow [mailto:[EMAIL PROTECTED]]
 Sent: 05 March 2001 03:50
 To: [EMAIL PROTECTED]
 Subject: Re: Iterating over collections with null values
 
 
 
 
 "Craig R. McClanahan" wrote:
  
  Bugzilla bug report #706 reports that you will get a JSP 
 page exception
  when you try to iterate over collection that contains null 
 values.  This
  is caused by the fact that the JSP page context refuses to 
 allow null
  attributes.  The bug report suggests one alternative (although the
  proposed implementation has problems), but I would like to solicit
  suggestions and thoughts on what the correct behavior should be.
  
  Here are the alternatives that I can think of:
  
  (1)  No change -- document a restriction in the usage notes
   on the logic:iterate tag.
  
  (2)  Silently skip this element of the iteration, with no notice
   to the surrounding page.  The total number of times through
   the loop, from the perspective of the page, will be less than
   the size of the underlying collection.
  
  (3)  Do not skip this element, but don't add it to the page context
   either.  The page can then use logic:notPresent to test for
   whether the item is actually there or not.
  
  (4)  Do not skip this element, but insert a reference to a dummy
   object instead of the null.  This is likely to cause class cast
   exceptions, and is unlikely to be practical when the iteration
   explicitly includes a "type" attribute.
  
  (5)  Other alternatives I have not thought of?
 
   (5) Add an attribute(s) on the iterate tag that allows the user to
 decide between (1), (2) and (3). Defaulting to (1).
 
  
  All of the listed alternatives have their problems, but I 
 am currently
  leaning towards (1).  Comments?  Suggestions?
  
  Craig McClanahan
 



Re: Iterating over collections with null values

2001-03-05 Thread Elod Horvath

Nick Pellow wrote:
 
 "Craig R. McClanahan" wrote:
 
  Bugzilla bug report #706 reports that you will get a JSP page exception
  when you try to iterate over collection that contains null values.  This
  is caused by the fact that the JSP page context refuses to allow null
  attributes.  The bug report suggests one alternative (although the
  proposed implementation has problems), but I would like to solicit
  suggestions and thoughts on what the correct behavior should be.
 
  Here are the alternatives that I can think of:
 
  (1)  No change -- document a restriction in the usage notes
   on the logic:iterate tag.
 
  (2)  Silently skip this element of the iteration, with no notice
   to the surrounding page.  The total number of times through
   the loop, from the perspective of the page, will be less than
   the size of the underlying collection.
 
  (3)  Do not skip this element, but don't add it to the page context
   either.  The page can then use logic:notPresent to test for
   whether the item is actually there or not.
 
  (4)  Do not skip this element, but insert a reference to a dummy
   object instead of the null.  This is likely to cause class cast
   exceptions, and is unlikely to be practical when the iteration
   explicitly includes a "type" attribute.
 
   (5) Add an attribute(s) on the iterate tag that allows the user to
 decide between (1), (2) and (3). Defaulting to (1).
 


i like (5).  it leaves me options.  as a developer, i like options.
i don't like being dictated to [by a framework tool].  :)
i know it's more work for a committer, but...
(4) is definitely out.  

e
-- 
___
Elod Horvath ('e')   /  ITFAIS Records (http://www.itfais.com/)



cvs commit: jakarta-struts/src/doc installation-ipas.xml

2001-03-05 Thread husted

husted  01/03/05 05:08:28

  Added:   src/doc  installation-ipas.xml
  Log:
  Add instructions for iPortal Application Server, submitted by John Ueltzhoeffer.
  
  Revision  ChangesPath
  1.1  jakarta-struts/src/doc/installation-ipas.xml
  
  Index: installation-ipas.xml
  ===
  ?xml version="1.0"?
  document url="./installation-ipas.xml"
  properties
  authorUeltzhoeffer/author 
  titleThe Struts Framework Project - Installation - iPortal Application 
Server/title
  /properties
  body
  
  section name="Installing Struts with your servlet container" href="Containers" 
  
  h3a name="ipas13"iPortal Application Server 1.3/a/h3
  
  pTested with: Windows 2000/p
  
  piImportant Note:/i At the moment, iPAS 1.3 is not fully compliant with the 
  JSP 1.1/1.2 specification. Specifically, the automatic type conversions 
  for custom tag parameters specified in "Issue 7" of the JSP 1.1 Errata 
  and in the JSP 1.2 Proposed Final Draft have not yet been implemented.
  As it stands, JSP pages that make use of Struts taglibs whose parameters 
  require conversion (such as booleans) will not compile under iPAS 1.3. 
  This includes the Struts Example Application. Attempting to run the 
  example a pplication will result in an exception similar to the 
  following being thrown: /p
  
  pre
  /struts-example/index.jsp:
  
  javax.servlet.ServletException: Compilation error occured:
  
  allaire.jrun.scripting.DefaultCFE: 
  
  Errors reported by compiler:
  
  c:/JRun/servers/default/Struts 
Example/WEB-INF/jsp/jrun__index2ejspa.java:41:1:41:27: 
  
  Error: No match was found for method "setLocale(java.lang.String)".
  /pre
  
  p(For more details see refer to: 
  a href="http://www.mail-archive.com/struts-user@jakarta.apache.org/msg01860.html"
  http://www.mail-archive.com/struts-user@jakarta.apache.org/msg01860.html/a)/p
  
  pThe following instructions describe how to install the Struts Example 
  Application under iPAS 1.3. A subsequent section describes how the Struts 
  Example Application can be patched to work with Struts./p
  
  pThe following instructions assume the following:/p
  
  ul
  lia href="./installation-jrun.html"JRun/a has been installed./li
  liBoth the Strut and XML Parser libraries are in your classpath./li
  /ul
  
  h4Installing the struts example application/h4
  
  ul
  liStart iPAS Services by clicking on the [Start iPAS Services] menu item. /li
  liStart the iPortal Application Server by clicking on the [iPortal Application 
  Server] menu item. /li
  liStart a command shell. Change to the code$INSTALLDIR\IONA/code and run the 
  setenvs.bat file./li
  liCreate a directory called jars./li
  /ul
  
  pNow run the EARSCO tool. Type codejava iportal.earsco/code and at the prompts 
do:/p
  
  ul
  liNext/li
  liType in the application name of codestruts-example/code then click next./li
  liIn step three click the check box and enter the name of the 
WAR codestruts-example/code.Then click next./li
  liClick on Finish./li
  /ul
  
  pNow you must copy the contents of the struts-example war into the EARSCO 
  directory structure as follows: /p
  
  pUnder code$INSTALLDIR\IONA\jars\struts-examples\src\struts-example.war/code 
you 
  copy contect into the following directories: etc, lib, src and web./p
  
  ul
  liCopy all files in the root directory br/
code$INSTALLDIR\jakarta-tomcat-3.2.1\webapps\struts-example\WEB-INF/codebr/
into the earsco directorybr/
code$INSTALLDIR\IONA\jars\struts-examples\src\struts-example.war\etc./codebr/
Do not copy in the classes or lib directories./li
  
  liCopy the directory br/

code$INSTALLDIR\jakarta-tomcat-3.2.1\webapps\struts-example\WEB-INF\lib/codebr/
into the earsco directorybr/
code$INSTALLDIR\IONA\jars\struts-examples\src\struts-example.war\lib./code/li
  
  liCopy the directory br/

code$INSTALLDIR\jakarta-tomcat-3.2.1\webapps\struts-example\WEB-INF\classes/codebr/
into the earsco directorybr/

code$INSTALLDIR\IONA\jars\struts-examples\src\struts-example.war\src./codebr//li
  
  liCopy the directory br/
code$INSTALLDIR\jakarta-tomcat-3.2.1\webapps\struts-example /codebr/
into the earsco directory br/

code$INSTALLDIR\IONA\jars\struts-examples\src\struts-example.war\web./codebr/ 
/li
  
  liNext modify the application.xml in the br/
code$INSTALLDIR\IONA\jars\struts-examples\etc/code directory to this: /li
  /ul
  
  pre
  lt;application
  
  lt;!-- Add display name --
lt;display-nameStruts Examplelt;/display-name
  ...
  /pre
  
  ul
  liLast update the cc.xml in the br/
code$INSTALLDIR\IONA\jars\struts-examples directory as follows:/code/li
  /ul
  
  pre
  lt;configuration
lt;web-app
  lt;context-rootstruts-examplelt;/context-root
lt;/web-app  
  lt;/configuration
  /pre
  
  pNow you are ready to compile and deploy the 

cvs commit: jakarta-struts/src/doc installation.xml

2001-03-05 Thread husted

husted  01/03/05 05:08:50

  Modified:src/doc  installation.xml
  Log:
  Add instructions for iPortal Application Server, submitted by John Ueltzhoeffer.
  
  Revision  ChangesPath
  1.19  +1 -0  jakarta-struts/src/doc/installation.xml
  
  Index: installation.xml
  ===
  RCS file: /home/cvs/jakarta-struts/src/doc/installation.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- installation.xml  2001/02/27 13:58:13 1.18
  +++ installation.xml  2001/03/05 13:08:45 1.19
  @@ -231,6 +231,7 @@
 liiPlanet Application Server - Service Pack 2 is recommended. Note that the 
database 
 object in the Struts-Example application is not compatible with this 
container./li
 liiPlanet Web Server - a href="installation-ip.html"Additional steps 
required./a/li
  +  liiPortal Application Server - a href="installation-ipas.html"Additional 
steps required./a/li
 liJRUN - a href="installation-jrun.html"Additional steps required./a/li
 liOrion Application Server - a href="installation-oas.html"Additional steps 
   required./a/li
  
  
  



cvs commit: jakarta-struts WhoWeAre

2001-03-05 Thread husted

husted  01/03/05 05:09:20

  Modified:.WhoWeAre
  Log:
  Update WhoWeAre bio.
  
  Revision  ChangesPath
  1.3   +24 -22jakarta-struts/WhoWeAre
  
  Index: WhoWeAre
  ===
  RCS file: /home/cvs/jakarta-struts/WhoWeAre,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WhoWeAre  2001/02/20 12:22:21 1.2
  +++ WhoWeAre  2001/03/05 13:09:16 1.3
  @@ -1,9 +1,10 @@
   Who We Are
   ==
   
  -Craig R. McClanahan
  
   
  +Craig R. McClanahan -- Committer
  +-
  +
   I've been involved with servlet and JSP technology since around 1998.  It
   started out that I needed a way to build some web applications for several
   projects, and liked Java a lot better than the alternatives.  I also liked the
  @@ -66,9 +67,10 @@
   I'm going to corrupt him with Java eventually :-), and a daughter in college.
   I'll happily let the other committers speak for themselves.
   
  +
   
  -Kevin Duffy
  
  +Kevin Duffy -- Developer
  +
   
   That's a lie. Craig stole my ideas!! It was me who started Struts..who just
   took it from under my nose and finished it!
  @@ -111,9 +113,10 @@
   Craig). I only wish I could work on his team!! Hey..and I live 20 minutes
   from Cupertino too! ;) (hint hint)
   
  +
   
  -Ted Husted
  ---
  +Ted Husted -- Committer
  +---
   
   My primary interest in Struts is to put it to work writing lots of
   real-life Web applications:-) To do that effectively means having good
  @@ -122,7 +125,7 @@
   
   I've been writing software for hire since 1984, but only recently jumped
   on the Java bandwagon. My initial interest was with electronic
  -publishing, and started converting my various print projects to
  +publishing, and started by converting my various print projects to
   electronic media. The "Information Superhighway" was still the private
   stomping ground of Universities and government agencies then. The rest
   of us had to make do with diskettes and bulletin boards.
  @@ -131,13 +134,12 @@
   for publishing on disk, the most popular being "Dart" and "Iris". In
   1992, Dart was awarded the Digital Quill for software excellence,
   featured in PC Magazine (February 1992), and bundled with McGraw Hill's
  -bookset, "Paperless Publishing" by Colin Hayes (McGraw Hill 1994). Dart
  -won an unprecedented second Digital Quill in 1993. Several titles that
  -used Iris for a publishing system have also won awards and been widely
  -distributed, including "Hermitville USA." I was also fortunate to find
  -kindred souls on CompuServe and America Online, who helped me pioneer
  -resources areas in 1993 and 1994 for the nascent electronic publishing
  -industry.
  +bookset,"Paperless Publishing" by Colin Hayes (McGraw Hill 1994). Dart
  +won a second Digital Quill in 1993. Several titles that used Iris for a 
  +publishing system have also won awards and been widely distributed, 
  +including "Hermitville USA." I was also fortunate to find kindred souls 
  +on CompuServe and America Online, who helped me pioneer resources areas 
  +in 1993 and 1994 for the nascent electronic publishing industry.
   
   I finally cut loose on the Internet in 1995, launching Epub News, an
   electronic newspage about electronic publishing. After taking on several
  @@ -151,16 +153,16 @@
   print-book idea), and I had a lot of fun bringing it forward onto the
   Web. (Now, if I only had time to bring it current and dress it up!)
   
  -One of my best clients is WXXI Public Broadcasting Council, where
  -serving as the station's Webmaster. WXXI provides public broadcasting
  -services for television and radio, and we are working to do the same
  -online. Along with providing companion Web sites for every WXXI
  +My favorite all-time client is is WXXI Public Broadcasting Council, 
  +where serving as the station's Webmaster. WXXI provides public 
  +broadcasting services for television and radio, and we are working to do 
  +the same online. Along with providing companion Web sites for every WXXI
   production, we stream both our AM and FM signals, in both Real and 
   QuickTime, with online archives in the works. It's a long journey, but 
   we've taken the first steps. I'm responsible for most of the regular 
   updates to the site, and much of the overall layout and design. We're 
   grateful to have won the PBS award for best Web site in our market for 
  -two years in a row.
  +two years running.
   
   Our most ambitious projects at WXXI have been Spring Marketplace 2000
   and the NY Election Finder. For Spring Marketplace, we put our annual
  @@ -171,8 +173,8 @@
   developed the Web-enabled database applications for both projects.
   
   Currently, I'm expanding the WXXI online auction software into a
  -complete package for hosting live and online auctions as 

Re: HTML generated on the FLY. So how can I use struts for this?

2001-03-05 Thread Ted Husted

Create an Action to generate and output your page, and then return null
to the controller.

 Mallari Kulkarni wrote:
 
 Hi Guys,
 
 My web page is generated on the fly. The no of form  elements are
 unknown. In this scenario,  how can I use the struts framework?
 
 Please help me.
 
 Thanks and bye
 Mallari

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/



Re: [PROPOSAL] Struts Source Directory Structure

2001-03-05 Thread eirik . lygre

I very much agree with Ted on especially point #2.

Eirik

++
Eirik Lygre
[EMAIL PROTECTED]
e-vita as, Stortorvet 3, Oslo
Mobil: (+47) 905 66476
Fax: (+47) 23 35 70 51







Ted Husted [EMAIL PROTECTED]
05.03.2001 15:02
Please respond to struts-dev


To:[EMAIL PROTECTED]
cc:
Subject:Re: [PROPOSAL] Struts Source Directory Structure


Craig R. McClanahan wrote:
   src/ Java sources for components
 example/ Sources for example webapp
 share/  Sources for struts.jar
 test/   Sources for test webapp
 unit/   Sources for unit tests
 upload/  Sources for upload webapp

...

   web/ Webapp sources for components
 blank/  Web files for blank webapp
 example/ Web files for example webapp
 template/ Web files for template webapp
 test/   Web files for test webapp
 upload/  Web files for upload webapp
 
 Comments?

These aren't necessarily targeted for the 1.0 timeframe, but 

(1) Eventually, I think we should give the Struts example application
a proper name, and make room for other example applications. I'd
actually like to do an examples (plural) application or some type of
toolkit that demonstrated how to do this and that. Like working FAQ. 

(2) It has always seemed to me that sources for any standalone Web
applications should be kept with that application, and that the src
folder should be reserved for the framework (struts.jar) and now the
unit tests.

(2-b) I guess my feeling here is that the org.apache.struts packages are
the kernel, and the rest is stuff we include with it, the way RedHat
or Mandrake include stuff with the linux kernel. For some reason, I feel
like we should also keep them separate in the tree.

(3) I'd actually like to do a Struts Development Kit and a Struts
Sampler. The Struts Sampler would just be a ZIP of the Web App WARS,
ready to plug and play. Since this would include the Struts blank
application and documentation, I think a person could actually start
writing Struts apps from there. If someone wants to build Struts, they
could get the SDK the source distribution. 

-Ted.




ATTENTION! Well-Paid Job in the Internet!

2001-03-05 Thread Please Read IT Carefully!
Title: ATTENTION! The Well-Paid Job in the Internet!
We wish You a pleasant and successful day!In RussianMake money without leaving Your computer!If You show some interest and patience and understand as IT works, You can earn up to $100,000 and more!!! During the following 120 days - it depends only on You. DOES  IT SEEMS TO BE IMPOSSIBLE?? Read this document to be sure there is no catch or deceit. If You are completely lazy - we beg Your pardon for the assumption!!!, then this  is not for You!!! You'd better do something like surfing either clicking on banners or not doing anything at all.!!! If the offer hasn't interested You, we bring our apologies and it is not necessary to get angry - "Spam" has its expenses, just as radio and TV, but do not forget, that the first billionaire of the USA, Dale Carnegie said:"I'll better earn 1% as a result of the efforts of 100 men, than 100% as a result of my own efforts."RISE ON THE WAY TO THE FINANCIAL INDEPENDENCE AND FREEDOM!!!Welcome to the 6X6!It is difficult to believe but nevertheless it is like that! People get richer and richer! Some of them can't recover from the shock which had come together with a heap of crust banknotes even some months later. While the others deliberate and doubt, people that believed in Business System 6X6 bathe now in money!...In view of prompt rates of development of the Internet and electronic commerce the number of users of the "World Wide Web" grows with the great speed. There are more than 15,000 new people who join the Internet daily...Copyright © 2000 6x6 MLM Corporation. All rights reserved.Ladies and Gentlemen!PLEASE READ THOUGHTFULLY AND ATTENTIVELY, TRYING NOT TO DISTRACT YOUR ATTENTION WITH EXTERNAL NOISES AND IRRITANTS, AND YOU'LL UNDERSTAND WHAT WILL MAKE YOU RATHER RICH AND FREE PEOPLE!!!It is difficult to believe but nevertheless it is like that! People get richer and richer! Some of them can't recover from the shock which had come together with a heap of crust banknotes even some months later. While the others deliberate and doubt, people that believed in Business System 6X6 bathe now in money! In a literal sense! Have You ever seen how the heap of the $5 bills under which the adult person entirelly finds room looks like?! It is 100 thousand dollars!!! Can You imagine how the heap of $1,000,000 which is earned by each third participant of the superprogram 6X6 looks like?! And what is the feeling when You, not getting troubled with work, start to receive envelopes with six dollars already on the second week and further the profit is much more! And eventually some months later You don't know how to get rid of the money! You even get a bit scary of this avalanches of the money!!!ALL THAT IT WILL NECESSARY TO DO - TO SEND THE ADVERTISING LETTERS VIA E-MAIL AND FROM TIME TO TIME TO CHECK YOUR MAILBOX OR TO GO TO THE BANK! YOU SHOULDN'T EVEN STRAIN THE BRAIN - THE SUPER COMPUTER BUSINESS SYSTEM 6X6 WILL MAKE EVERYTHING ITSELF!!!SINCE THE MOMENT YOU ENTER THIS BUSINESS YOUR PROFIT SNOWBALLS AND BY THE END OF 4TH MONTH YOU'LL GET AS MINIMUM $100,000. BUT IF YOU DON'T STOP THE RESULTS WILL BE ASTRONOMICAL - $1,000,000 FOR 1 YEAR"What is the secret of such dizzy success?" - You ask. This is because there is a new formula in the business system which provides all participants with 100%-s' success due to the account of such special factors which the human brain is simply not capable of grasping. Therefore this excellent program works! And it works brilliantly! This is a prodigy-system in which success is madly infectious! Hurry up to achieve the success too!!!TRY YOURSELF!!!Have You ever wondered why the majority of  people achieve nothing in life but only complain? This is because they are ready on a little in their life. They have a ready definitions on everything, but these definitions are formulated not by them and taken from the others. To have Your own opinion is a luxury and rarity. Those who are not afraid to try and work more than doubts very quickly appears at the top of the World! Yes, it is difficult to believe that it is possible to get rich so quickly, difficult to overcome the doubts and find Yourself suddenly fantastically rich. But believe if You will do it, it becomes Your blessing and Your dizzy success! You will not argue that You are worthy of big success and big richness, will You? And so it is vitally necessary for You to do this step to find the financial independence which will bring You co-operation with superprogram 6X6! Your time has come!"Pair words about the system..." - an interview with Igor Tichtchenkov, the founder of the business system- In view of prompt rates of development of the Internet and electronic commerce the number of users of the "World Wide Web" grows with the great speed. There are more than 15,000 new people who join the Internet daily. With the growth of number of the Internet's users the number of different types of business programs also grows. Every day their popularity 

logic:present Property Oddity?

2001-03-05 Thread Michael McCallister

I never saw any comment on this in struts-user.  Perhaps it is better for 
struts-dev.


Mike

Date: Mon, 26 Feb 2001 11:18:38 MST
From: "Michael McCallister (r2126c)" [EMAIL PROTECTED]
Subject: logic:present Property Oddity?
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Apparently-To: "Michael_McCallister-R2126C@email" r2126c@msgphx8
X-Motorola-Sent-Wireless: 1

I'm using the logic:present tag to avoid displaying a section of a 
html:form if a particular bean is missing.  Given the documentation, I expected

 logic:present scope="session" name="myBean" property="myProperty"

to behave something like this (in pseudocode):

 if (session.getAttribute("myBean") != null 
 session.getAttribute("myBean").getMyProperty() != null)
 // Display the body of the logic:present tag

but instead, it seems to behave like this:

 if (session.getAttribute("myBean").getMyProperty() != null)
 // Display the body of the logic:present tag

The problem this causes is that if I specify a property and my session 
bean doesn't exist, I get a ServletException that complains "Cannot find 
bean myBean in scope session".  In order to get the behavior I expect, it 
looks like I have to nest some logic:present tags like this:

 logic:present scope="session" name="myBean"
 logic:present scope="session" name="myBean" property="myProperty"

Which, of course, looks unnecessarily redundant.  Is this behavior as 
intended, or is this a bug?  If the behavior changed to the form I 
expected, would this cause any existing user code to break?


Mike


Mike McCallister




non-String properties and html:options

2001-03-05 Thread Gordon Maclean


I want to present a selection of Integers for the user
to choose.  The jsp code is:

  html:select property="beginYear"
html:options property="years"/
  /html:select

The form bean has an indexed property "years":
public Integer [] getYears();

The above jsp code fails with this message:

   Root cause: 
 java.lang.ClassCastException: java.lang.Integer
  at
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:240)

when org.apache.struts.taglib/html.OptionsTab.doEndTag tries a direct
cast of Integer to String.

I understand that the "beginYear" property must be settable from a
String, but
it seems that the options tag should be able to call toString when
needed to
display properties (to simplify incorporating existing beans into
struts).
I believe html:options does do toString when the "collection" attribute
is specified.

The following short fix to OptionsTag does the trick.  

Am I right that this is a bug/shortcoming with html:options, or is there
a simple 
way around it (logic:iterator?) ?


--- OptionsTag.orig Sat Feb 24 11:36:21 2001
+++ OptionsTag.java Tue Mar  6 14:19:43 2001
@@ -237,10 +237,10 @@
 
   // Render the options tags for each element of the values
coll.
   while (valuesIterator.hasNext()) {
-  String value = (String) valuesIterator.next();
+  String value = valuesIterator.next().toString();
   String label = value;
   if (labelsIterator.hasNext())
-  label = (String) labelsIterator.next();
+  label = (String)
labelsIterator.next().toString();
   addOption(sb, value, label,
 selectTag.isMatched(value));
   }





-- 
*
Gordon Maclean, Software Engineer
http://www.atd.ucar.edu/homes/maclean
Nat'l Center for Atmospheric Research, Boulder CO USA
*



Re: Iterating over collections with null values

2001-03-05 Thread Martin Cooper

(1) This would be fine with me. Given that there seem to be as many opinions
on this subject as people expressing them, perhaps this would be the
expedient choice for 1.0.

(2) I don't like this because of the disparity between the number of
iterations and the size of the collection. The bean:size tag becomes
somewhat less useful.

(3) I believe this is the best of the "do something" options. It effectively
documents the issue and provides a simple way of handling it.

(4) This sounds like a pretty bad idea. :-}

(5) I really don't like this. It makes me think of Perl's "There's More Than
One Way To Do It" slogan. IMHO, having more options is not always better.

--
Martin Cooper


- Original Message -
From: "Nick Pellow" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, March 04, 2001 7:50 PM
Subject: Re: Iterating over collections with null values




 "Craig R. McClanahan" wrote:
 
  Bugzilla bug report #706 reports that you will get a JSP page exception
  when you try to iterate over collection that contains null values.  This
  is caused by the fact that the JSP page context refuses to allow null
  attributes.  The bug report suggests one alternative (although the
  proposed implementation has problems), but I would like to solicit
  suggestions and thoughts on what the correct behavior should be.
 
  Here are the alternatives that I can think of:
 
  (1)  No change -- document a restriction in the usage notes
   on the logic:iterate tag.
 
  (2)  Silently skip this element of the iteration, with no notice
   to the surrounding page.  The total number of times through
   the loop, from the perspective of the page, will be less than
   the size of the underlying collection.
 
  (3)  Do not skip this element, but don't add it to the page context
   either.  The page can then use logic:notPresent to test for
   whether the item is actually there or not.
 
  (4)  Do not skip this element, but insert a reference to a dummy
   object instead of the null.  This is likely to cause class cast
   exceptions, and is unlikely to be practical when the iteration
   explicitly includes a "type" attribute.
 
  (5)  Other alternatives I have not thought of?

   (5) Add an attribute(s) on the iterate tag that allows the user to
 decide between (1), (2) and (3). Defaulting to (1).

 
  All of the listed alternatives have their problems, but I am currently
  leaning towards (1).  Comments?  Suggestions?
 
  Craig McClanahan