Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:include

 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to include even a single file in my jsp using <jsp:include>
Following is my code:

<%@ page language="java" contentType="text/html" %>
<html>
<head>
</head>
<body>
<jsp:include page="test1.html" flush="true"/>
</body>
</html>

can anybody suggest something.
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to use <jsp:include> to display files from my system.But, i am not able to use <jsp:include> to include files from a remote system.Is that the limitation of <jsp:include>
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to use <jsp:include> to display files from my system.But, i am not able to use <jsp:include> to include files from a remote system.Is that the limitation of <jsp:include>


Yes! <jsp:include> standard action and include directive <%@include..> can include resources only from same context alone. If you want to include external pages then you can use JSTL's <c:import> tag.

<c:import url=""/>
 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i used <c:import url="\\\\pc-103\\xyz\\a.html"/>

but still nothing is included in my jsp page. please let me know if i need to add something else in jsp page or somewhere in web.xml
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
="\\\\pc-103\\xyz\\a.html"


I don't think it is a valid URL.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srikanth Nutigattu:
I don't think it is a valid URL.

It's not. It's a Windows file path. Won't work.

It needs to be a URL to a resource that is served by a web server.
 
Mike Yan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sometime i have the thing problem,i dont know too
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic