Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

JSTL c:import tag problem

Thread view: 
alan_sec - 20 Mar 2006 12:08 GMT
I have a problem using JSTL tag c:import.
When i use jsp:include it works and if i use c:import i doesn't work. I
don't know what is the problem.

jsp file:

this works:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
...
<table width="100%">
    <tr>
        <td>
            <jsp:include page="predefined/predefined1.jsp"/>
        </td>
    </tr>
</table>

but this doesn't:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
...
<table width="100%">
    <tr>
        <td>
            <c:import url="predefined/predefined1.jsp" />
        </td>
    </tr>
</table>

predefined/predefined1.jsp
The file that is being included (predefined/predefined1.jsp) is file on
local disk.
Alan
stephen.mcelhinney@gmail.com - 30 Mar 2006 16:24 GMT
Hi Alan

Do the logs tell you whether or not they've found your taglibs? What
servlet container are you using?

Also, I've never used c:import with relative URLs, as far as I know it
requires a fully-qualified URL.

You could achieve this by doing a scriptlet. Something like

String filename = "foo.jsp";
pageContext.setAttribute("fullurl",
request.getScheme()+"://"+request.getServerName()+request.getContextPath()+"/"+filename);

and then in the import tag

<c:import url="${fullurl}" charEncoding="UTF-8"/>

(obviously change the encoding to whatever you need it to!)

Hope this gives you some ideas.

Thanks
Stephen

> I have a problem using JSTL tag c:import.
> When i use jsp:include it works and if i use c:import i doesn't work. I
[quoted text clipped - 28 lines]
> local disk.
> Alan


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.