tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmk...@earthlink.net (David M. Karr)
Subject Re: Any way to import file as a resource?
Date Sun, 01 Sep 2002 18:52:58 GMT
>>>>> "Martin" == Martin Cooper <martin.cooper@tumbleweed.com> writes:

    >> -----Original Message-----
    >> From: dmkarr@earthlink.net [mailto:dmkarr@earthlink.net]
    >> Sent: Saturday, August 31, 2002 9:26 PM
    >> To: taglibs-user@jakarta.apache.org
    >> Subject: Re: Any way to import file as a resource?
    >> 
    >> 
    >> >>>>> "David" == David M Karr <dmkarr@earthlink.net> writes:
    >> 
    >> >>>>> "Martin" == Martin Cooper <martin.cooper@tumbleweed.com>
writes:
    Martin> I'm not sure why you say <c:import> won't work. 
    >> You can do this, which I
    Martin> think is what you want:
    >> 
    Martin> <c:import var="xml" url="/WEB-INF/web.xml"/>
    >> 
    David> Hmm.  That wasn't working.  The resulting variable 
    >> was empty.  I guess I'll
    David> have to track it in the debugger.  I don't see 
    >> what could be wrong.
    >> 
    >> After tracking the "c:import of "/WEB-INF/web.xml", I don't 
    >> see why I didn't
    >> get anything.  However, I did try adding imports of several 
    >> other files, to see
    >> whether they worked or not:
    >> 
    >> /thing.xml:                     Worked
    >> /dir/thing2.xml:                Worked
    >> /WEB-INF/anotherThing.xml:      Failed
    >> /WEB-INF/struts-config.xml:     Failed
    >> 
    >> Is this related to the restriction against directly serving 
    >> files in the
    >> WEB-INF directory?  I had no problem getting 
    >> "/WEB-INF/web.xml" with the
    >> bean:resource Struts tag.  All of these tests are running in TC 4.0.4.

    Martin> This looks like a bug in Tomcat 4.0.4. I've now tested the JSP code I posted
    Martin> in Resin 2.1.4 with fast JSTL (i.e. Resin's own implementation) and regular
    Martin> JSTL (i.e. the Jakarta Taglibs implementation), and in Tomcat 4.0.4 and
    Martin> Tomcat 4.1.10. The only one that failed was Tomcat 4.0.4.

    Martin> Looks like time to upgrade! ;-)

Yup.  After setting up 4.1.10, "c:import" of anything in "WEB-INF" now works
fine (and the manager app is REALLY nice).

However, I've come to the conclusion that the "bean:resource" tag is still
useful in the new library.  The only (well, ok, probably more than one :) )
reason "c:import" now works for XML files in "WEB-INF" is that there's no
servlet mapped for that url pattern.  If I want to open a file in the
application as a resource, I really should do exactly that.  I don't think
there's any practical way to use "c:import" to load in the source code of a JSP
page, for a "showSource" page, for instance.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message