On Mon, 24 Jun 2002, Kin-Man Chung wrote: > > > Use of scripting varibles in nested tag never work before, so obviously > > > no body uses it much. I think the whole scripting variable in JSP1.2 is > > > poorly designed, and not well understood. > > > > The failures are from an app that worked perfectly fine with > > jasper1, and with jasper2 ( up to 4.1.4 ). > > > > And IMHO are very elementary use cases - 2 iterates and one > > condition is not that infrequent. > > > > jasper1 and old jasper2 implements scripting variables by declaring them > when a tag handler is instantiated, inside a block of its own, like
My problem is that code that worked with jasper1 no longer works with jasper2. And I believe the use case is valid and within the spec, and quite common. The latest failure is just 2 iterate tags and a condition tag - I think it should work. Costin > > { > String x; // variable x defined here > ... > } > > This implementation has 2 problems. > > 1) Nested tags with same variable does not work > > <mytag:foo> > <mytag:foo> > </mytag:foo> > </mytag:foo> > > because you cannot have two varibles of the same name in Java, even if > they are in blocks nested within one another. > > 2) The variables are out of scope when the tag ends, but for variables > with AT_BEGIN scope, spec says they should be accessable until the > end of the page. > > > > > > > How do we deal with nested tags of different type ? I don't have > > > > a test case, but I assume someone may have a NESTED tag > > > > 'foo' in 2 different tags, with different declared types ( String and > > > > Integer ). The current generator seems to not create { }, > > > > and I'm not sure how this will work. > > > > > > > > ( no test case - but I'm sure you can find such tags ) > > > > > > > > > > That would not work, and would never be made to work, not only for > > > nested case, but also for non-nested tags with AT_BEGIN scopes. > > > I tend to think this falls into the user's reponsibility if she uses > > > the same variable name for two different types, somewhat analogous to > > > declaring two variables of the same name two different types in Java. > > > > I'm lost here - wasn't NESTED supposed to define a lexical scoping ? > > I don't see why this wouldn't work - are you saying it doesn't > > work with jasper2, it didn't worked with jasper1, or is not > > required by the spec ? > > > > You cannot have > > { > String x; > { > String x; > } > } > > in Java, so we are implementing scripting variables with nested scopes as > > { > String x; > { > String temp = x; > ... > } > x = temp; > } > > You can see why we'll have problems if two variables nesting with one > anothers have the same name but different types. > > > > > > Hopefully, there won't be a need for scripting variables anymore when > > > expression language becomes available in JSP2.0. > > > > :-) > > > > Unfortunately JSP1.x will be around for a while, and jasper must support > > it. > > > > Costin > > > > > -- > 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]>