See in the discussion link >>>>
However, you may be right that the tag lib spec allows the use of type attribute only. In http://java.sun.com/products/jsp/tags/11/syntaxref11.fm14.html , it first says "If the Bean does not exist, <jsp:useBean> instantiates it from a class or serialized template." and then on the attribute description: type="package.class" If the Bean already exists in the scope, gives the Bean a data type other than the class from which it was instantiated. If you use type without class or beanName, no Bean is instantiated. The package and class name are case sensitive. <<<< and then the quoted spec seems self-contradicting: >>>> Here are some relevant snippets from the JSP 2.1 spec. However, as far as I know the sections haven't changed for either 2.0 or 2.1 versions: *(section JSP 5.1, <jsp:useBean>)* It is also possible to use this action to give a local name to an object defined elsewhere, as in another JSP page or in a servlet. This can be done by using the type attribute and not providing class or beanName attributes. In the final example, the object should have been present in the session. If so, it is given the local name wombat with WombatType. A ClassCastException may be raised if the object is of the wrong class, and an InstantiationException may be raised if the object is not defined. <jsp:useBean id="wombat" type="my.WombatType" scope="session"/> <<<< And for all practical purposes, useBean should allow setting the variable to null because many classes are "bean-like" and not strict JavaBean and it is also harder to tell if it is an valid bean or an "empty" bean. On Tue, Jun 17, 2008 at 12:09 PM, Scott Ferguson <[EMAIL PROTECTED]> wrote: > > On Jun 17, 2008, at 11:51 AM, Hacking Bear wrote: > > Hi, > > As we are discussing some other issues, we found a potential serious > problem with jsp:useBean. Basically, if useBean only has the type parameter > but not the class/bean parameters, the resin server will fail because it > does not know what to instantiate, contrary to the spec. > > <!-- should set foo to null but fail instead. --> > <jsp:useBean id="foo" type="java.lang.String" scope="request"/> > > > How is that contrary to the spec? > > JSP.5.1 > > > 5. If the object is not found in the specified scope and neither class or > beanName > > are given, a java.lang.InstantiationException shall occur. This > completes the > > processing of thisjsp:useBean action. > > -- Scott > > > > For the full discussion of the bug and the JSP spec, see > http://www.jetbrains.net/jira/browse/IDEA-18405 > > The strange thing is that Tomcat behaves the same. So I wonder if this is a > bug or a legacy problem for the servers due to confusing descriptions in > earlier JSP spec? > > Please enlighten me! > > Thanks > _______________________________________________ > resin-interest mailing list > resin-interest@caucho.com > http://maillist.caucho.com/mailman/listinfo/resin-interest > > > > _______________________________________________ > resin-interest mailing list > resin-interest@caucho.com > http://maillist.caucho.com/mailman/listinfo/resin-interest > >
_______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest