Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: JSTL c:import 404

Thread Tools

Re: JSTL c:import 404

Posts: n/a
Jan-Friedrich Mutter wrote:
> Hi,
> I'm using the Java Standard Tag Library (JSTL) 1.3. I use the c:import
> tag to include a html snipplet from elsewhere. Sometimes this URL is
> not available. Thus the import tag throws an exception:
> javax.servlet.jsp.JspException: Problem accessing the absolute URL
> "http://local
> host...".
> Response: '404: Not Found' for url: 'http://localhost...'
> at org.apache.taglibs.standard.tag.common.core.Import Support.acquireReader(
> ...
> My JSP code is:
> <% String myUrl="http://localhost..."; %>
> <c_rt:import url='<%=myUrl%>' var="externalHtml" scope="request"/>
> Due to the exception my whole JSP page is not avaible even only that
> little html snipplet I imported is not available. But my JSP should be
> available even when the 'import' fails.
> Is there a way to ignore the exception and let the space blank?
> Cheers,
> Jan.

<% String myUrl="http://localhost...";
try {
<c_rt:import url='<%=myUrl%>' var="externalHtml" scope="request"/>
catch( Exception e ) {
// print a diagnostic or ignore

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
JSTL: How do I set an array variable? Derek Mahar Java 2 06-07-2011 06:39 PM
(struts/JSTL) Setting bean property value with jstl choose compoundresults DaFoot Java 1 10-23-2008 12:42 PM
Intercept IIS 404 errors? Issue with Viewstate and 404 Jonathan Folland ASP .Net 2 03-17-2005 02:32 AM
Custom JSTL that accepts JSTL expression Robert Mark Bram Java 0 12-15-2004 12:26 AM
JSTL to C# conversion? steve ASP .Net 2 06-01-2004 01:14 PM