Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

page relative vs file relative [ include action vs include directive]

 
Raj Paul
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anybody explain abt page relative vs file relative. As per jsp spec 1.2
include action has page relative URL & include directive has file relative URL.
They have given some sample files also. I couldnt understand. [ JSP.4.4 ]
Thanks & Regards
Mike
 
Tybon Wu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page relative means the path of the file you want to include is relative to the current URL. File relative means the path of the file you want to include is relative to the path of the file that contains the include directive. Yeah sounds confusing doesn't it?
 
Raj Paul
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Suppose for example,[ From JSP Spec ]
if i have A.jsp & C.jsp & dir/B.jsp & dir/C.jsp

The Content of A.jsp is
<%@ include file="B.jsp" %>
The Content of B.jsp is
<jsp:include page="C.jsp" />

Which file output will be included....the file which is with A.jsp or the file with dir/C.jsp
Please explain relatively with page & file relative path
Thanks & Regards
Mike
 
Tybon Wu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming we are currently viewing A.jsp in a browser.
The content of A.jsp contains the include directive
<%@ include file="B.jsp" %>
Since include directives are file relative, the path of B.jsp is relative to the path of A.jsp, in this case B.jsp must be in the same folder as A.jsp.
Now, the content of B.jsp contains the include action
<jsp:include page="C.jsp" />
Since include actions are page relative, the path of C.jsp is relative to the current URL, which is the URL of A.jsp (because that's the page we are currently viewing). Therefore C.jsp must also be in the same folder as A.jsp.
[ July 24, 2002: Message edited by: Tybon Wu ]
 
Raj Paul
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool...
Thanks & Regards
Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic