Quoting Hans Bergsten <[EMAIL PROTECTED]>:

> Adam Hardy wrote:
> > I do have a reason for upgrading - I'm not just a masochist ;) - I need 
> > the character encoding features of the servlet 2.4 spec. Thanks for the 
> > explanation of that error on the struts taglibs. Makes sense. It was the 
> > same error as I was getting from the old jstl 1.0.4 taglibs, which also 
> > makes sense.
> > 
> > So essentially the Struts taglibs need new TLDs for JSP 2.0. It sounds 
> > like the code doesn't have to change, is that so? 
> 
> Someone who knows more about Struts than I do may correct me on this,
> but I believe you can simply switch to the regular, non-EL version of
> the Struts libraries.
> 
> The main point is that an EL version of a tag library declares all
> attributes as String attributes that don't take "request-time attribute
> values" (rtexprvalues), and evaluates all EL strings itself. In JSP 2.0,
> both EL and Java expressions can be used as rtexprvalues, and the
> container takes care of the  evaluation of both types. The tag library
> must therefore declare the attributes as rtexprvalues, and whatever the
> native type of the attribute is instead of String. This typically means
> that a version of the library that's ignorant of EL expressions works
> fine with JSP 2.0.

Right. In fact, here's a (stupid) example using one of the standard (non-EL)
Struts 1.1 tags:

<%@ page contentType="text/plain" %>
<%@ taglib prefix="bean" uri="http://jakarta.apache.org/struts/tags-bean"; %>
<%@ taglib prefix="c"    uri="http://java.sun.com/jsp/jstl/core"; %>
<c:set var="mapName" value="map"/>
<jsp:useBean id="map" class="java.util.HashMap"/>
<c:set target="${map}" property='<%= "foo" %>' value="bar"/>
<bean:size id="mapSize" name="${mapName}"/>
Map: ${map}
Map size: ${mapSize}

Which outputs:

Map: {foo=bar}
Map size: 1

So, with JSP 2.0, you get to use *either* a scriptlet expression or an EL
expression for your tag attribute values. This is true even for JSP 1.1 taglibs,
like Struts.

> > I've got the JSTL 1.1 
> > spec, I'll check it out.
> > 
> > Re: the tomcat start-up exceptions
> > 
> > preRegister with Catalina:type=Logger,path=/blacksail,host=localhost
> > org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content 
> > starting with element 'jsp-version'. The content must match
> > 
> >
>
'((("http://java.sun.com/xml/ns/j2ee":description){0-UNBOUNDED},("http://java.sun.com/xml/ns/j2ee":display-name){0-UNBOUNDED},("http://java.sun.com/xml/ns/j2ee":icon){0-UNBOUNDED}),("http://java.sun.com/xml/ns/j2ee":tlib-version),("http://java.sun.com/xml/ns/j2ee":short-name),("http://java.sun.com/xml/ns/j2ee":uri){0-1},("http://java.sun.com/xml/ns/j2ee":validator){0-1},("http://java.sun.com/xml/ns/j2ee":listener){0-UNBOUNDED},("http://java.sun.com/xml/ns/j2ee":tag){0-UNBOUNDED},("http://java.sun.com/xml/ns/j2ee":tag-file){0-UNBOUNDED},("http://java.sun.com/xml/ns/j2ee":function){0-UNBOUNDED},("http://java.sun.com/xml/ns/j2ee":taglib-extension){0-UNBOUNDED})'.
> 
> > 
> > 
> > This is some sort of xml parsing problem, I've narrowed it down to the 
> > following declaration in tomcat's server.xml:
> > 
> >       <Host name="localhost"
> >             debug="0"
> >             appBase="webapps"
> >             unpackWARs="true"
> >             autoDeploy="true"
> >             xmlValidation="true"
> >             xmlNamespaceAware="true">
> > 
> > When I remove the xmlValidation & xmlNamespaceAware attributes, the 
> > startup exceptions disappear. I put these attributes in as true so that 
> > tomcat would catch any errors I make in the server.xml. Obviously I can 
> > live without it or even live with the errors, but it's not happy.
> > 
> > And the exceptions only occur on startup if I delete the tld caches.
> > 
> > It seems this is an issue with jakarta-taglibs and tomcat, rather than 
> > with my configuration. Is that so?
> 
> I've seen some messages on the Tomcat Developers list about problems
> with XML Schema validation due to bugs in the bundled version of Xerces.
> If you absolutely need the validation, you may want to try to replace it
> with a different JAXP compliant XML parser that handles XML Schema
> validation.
> 
> Hans
> 
> > On 10/02/2003 11:59 PM Hans Bergsten wrote:
> > 
> >> To make a long story short, if you primarily want to upgrade to TC 5 and
> >> have no interest in using the new JSP 2.0 features, continue to use the
> >> Servlet 2.3 deployment descriptor (DD) instead of changing it to a 2.4
> >> DD. A JSP 2.0 container (like TC 5) treats an app with a 2.3 DD just as
> >> a JSP 1.2 container, so the app should just work as-is if you do this.
> >>
> >> If you change to a 2.4 DD, you're telling the JSP container to handle
> >> all EL expressions (instead of letting the JSTL (Or custom library, like
> >> Struts) tag handlers handle them). For this to work, you need to change
> >> all tag libraries to JSP 2.0 versions (where the attributes are marked
> >> as accepting "request-time attribute values"). JSTL 1.1 defines new
> >> versions of all libraries for this purpose (with new URIs). I'm not sure
> >> if there are JSP 2.0 versions of the Struts EL libraries, though.
> >>
> >> For more on this, see the JSTL 1.1 spec.
> >>
> >> Hans
> 
> 
> -- 
> Hans Bergsten                                <[EMAIL PROTECTED]>
> Gefion Software                       <http://www.gefionsoftware.com/>
> Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
> Details at                                    <http://TheJSPBook.com/>

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to