Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 91214 invoked from network); 19 Sep 2000 22:24:18 -0000 Received: from unknown (HELO pst.praja.com) (64.240.239.20) by locus.apache.org with SMTP; 19 Sep 2000 22:24:18 -0000 Received: by PST with Internet Mail Service (5.5.2650.21) id ; Tue, 19 Sep 2000 15:15:28 -0700 Message-ID: <0941E0D29BB1D21184F300105A9CB785C9EA79@PST> From: Arun Katkere To: "'tomcat-dev@jakarta.apache.org'" Subject: RE: Spec Q/TagBeginGenerator behavior Date: Tue, 19 Sep 2000 15:13:41 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N > -----Original Message----- > From: Pierre Delisle [mailto:pierre.delisle@sun.com] > Sent: Tuesday, September 19, 2000 2:52 PM > To: tomcat-dev@jakarta.apache.org > Subject: Re: Spec Q/TagBeginGenerator behavior > > > > Arun Katkere wrote: > > > > TagBeginGenerator does compile time conversion from String > to the type of > > the property as specified in the spec. table 2-4 (section > 2.13.2) and more > > (looking at the code). But, it doesn't work for property of type > > java.lang.Object. So, if I have a tag (say foo) with a > property of type > > object (say attr1), the following doesn't work: > > > > > > > > (fails compilation with "Unable to convert a String to > java.lang.Object for > > attribute attr1"). > > > > If we change it to the following uglyness, it works: > > > > <% String bar = "bar"; %> > > > > > > Questions: > > > > 1. Is String to java.lang.Object implicit conversion a > spec. oversight or is > > there a good reason for not supporting it. Since java.lang.String is > > java.lang.Object, it seems strange to say, "Unable to > convert String to > > java.lang.Object" when String *is* an Object. > > Your point is well taken. I've forwarded your email to the > JSP spec lead to > get his official comments on this. BTW, I noticed that in JSP 1.2, this will work as long as PropertyEditor for that property exists and setAsText() is implemented. So, the spec. folks may have already given this some thought. > > 2. Regardless of how the spec. feels about it, can Jasper > support this as a > > non-normative feature? As far as I can see, it is just one > (half) a line in > > TagBeginGenerator, change "if (c == String.class)" to "if > (c == String.class > > || c == Object.class)" in convertString method. > > Jasper is the reference implementation for the JSP spec. > Can't have non-normative > features :-(. I will probably make people who use these features made at me, but TagBeginGenerator.convertString already has these non-normative conversions (at least according to comments in code): - String to char - String to Character (These conversions are in the aforementioned table, but refer to nonexistent java.lang.Character.valueOf()). > > 3. Does anyone have a workaround suggestion (other than > providing a attr1Str > > property that calls setAttr1(): difficult to explain to the > tag library > > user)? > > Can't attr1 become attr1Obj, and have attr1 be the string? > Well, we want the tag to accept values that may not have an apparent String -> appropriate type conversion. E.g., property of type java.util.GregorianCalendar. -arun