struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: BEA Claims about Struts on Weblogic
Date Fri, 22 Sep 2000 17:11:22 GMT
See intermixed for a couple of comments.

Luke Taylor wrote:

> Hi, I just spotted this in the Weblogic.developer.interest.jsp
> newsgroup. Is this genuine criticism or just another attempt to cover
> up the fact that getting stuff to run in Weblogic is such a nightmare?
>
> > From:
> >         "WebLogic" <sam@bea.com>
> >
> >  Subject:
> >         Re: Running Struts on weblogic
> >
> > You should be able to get past this point with service pack 5.  One of the
> > problems with struts is that some of
> > the pages take advantage of non-standard behaviour in Tomcat, however.  For
> > example, in the bean-cookie.jsp
> > test they attempt to set a property on a bean that was never useBeaned.
> > Section 2.13.2, JSP 1.1 spec:
>

The "bean-cookie.jsp" actually uses <jsp:getProperty>, not <jsp:setProperty>.

In this particular case the relevant spec language is Section 2.13.3:

    "An <jsp:getProperty> action places the value of a Bean instance
    property, converted to a String, into the implicit out object, from
    which you can display the value as output.  The Bean instance
    must be defined as indicated in the name attribute before this point
    in the page (usually via a useBean action).

Note the word "usually" -- the reason it is here is because custom tags can be
defining elements as well, as long as they use the corresponding TagExtraInfo
class and, in the tag, call pageContext.setAttribute() appropriately.  In this
page, the call

    <bean:cookie id="sess" name="JSESSIONID"/>

is the defining element that looks up the cookie named "JSESSIONID" (more on that
name below) and exposes it as a JSP bean.  This tag preceeds the use of the bean
in statements like this:

    <jsp:getProperty name="sess" property="domain"/>

which looks up the "domain" property of the cookie (i.e. it calls getDomain()) and
writes that to the output stream.

Thus, this page conforms to the JSP 1.1 spec requirements.

> >
> > The name of a Bean instance defined by a <jsp:useBean> element or some other
> > element. The Bean instance must contain the property you want to set. The
> > defining element (in JSP 1.1 only a <jsp:useBean> element) must appear
> > before the <jsp:setProperty> element in the same file.
>

Note the phrase "or some other element" -- again, custom beans can be defining
elements, so this page would be valid even if it had been using <jsp:setProperty>
instead.  It is interesting to note that the corresponding paragraph in the JSP
1.2 draft specification (Section 4.2.2.1, p. 63) has been clarified to indicate
this:

    "The name of a Bean instance defined by a <jsp:useBean>
    or some other element.  The Bean instance must contain the
    property you want to set.  The defining element must appear
    before the <jsp:setProperty> element in the same file.

so the confusing parenthetical comment about <jsp:useBean> has been removed.  Even
if it's a little inconsistent in 1.1, the intent is clear -- custom tags can be
defining elements for JSP-accessible beans.  That is the whole point of the
TagExtraInfo functionality.

> >
> > They also hard-code the Tomcat session identifier into the tests.  If you
> > want them to work either change the weblogic cookie name to JSESSIONID or
> > change the references to JSESSIONID to WebLogicSession.
>

Servlet API Specification, Version 2.2, Section 7.1.2, p. 35:

    "Session tracking through HTTP cookies is the most used
    session tracking mechanism and is required to be supported
    by all servlet containers.  The container sends a cookie to the
    client.  The client will then return the cookie on each subsequent
    request to the server unambiguously associating the request
    with a session.  The name of the session tracking cookie must
    be JSESSIONID.

Prior to 2.2, the servlet container could use whatever cookie name it wanted.
However, for 2.2 onwards, the cookie name is fixed for all containers.

> >
> > Sam
>

There may well be spec compliance issues with Struts that need to be fixed (such
as the current question over whether body content can be accessed in the
doEndTag() method of a custom tag).  However, on these two issues, Struts complies
with the specification.

>
> --
>  Luke Taylor.
>  PGP Key ID: 0x57E9523C

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Mime
View raw message