File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes the answer is not right? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "the answer is not right?" Watch "the answer is not right?" New topic
Author

the answer is not right?

Niu Xiuyuan
Ranch Hand

Joined: Jun 08, 2001
Posts: 68
here is the question in a mock:
Given the following to JSP files select the right answers.
<!-- file container.jsp -->
<html><body>
<%@ include file=�included.jsp� %>
<%@ page errorPage=�OneErrorPage.jsp� %>
</body></htm>
////////// different file
<!-- file included.jsp -->
<html><body>
<%@ page errorPage=�AnotherErrorPage.jsp� %>
<i>Hello</i>
</body></html>
1) File container.jsp will compile if the directive page comes before the directive include
2) File container will compile and when executed it will show:�Hello�.
3) File container.jsp will compile if the errorPage in container.jsp is the same as in file included.jsp.
4) File container.jsp will compile if instead of directive include (<%@ include ...%> it is used the action include

here is the answer:
) File container.jsp will compile if instead of directive include (<%@ include ...%> it is used the action include (<jsp:include ...>
explanation:
With directive include (<%@ include file=�fileName� %> the file is literaly included before compilation.In this case we have then, two lines with directive page both with attribute errorPage.That's an error. Then only attribute of directive page that can occur more than once is import.
i use resin2.02 as the web server,and i can compile the file which mentioned above and no error occurs.why? i don't find any difference bewteen <jsp:inclde...and <%@include....
who can explain it for me?


Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
You should indeed find out about the differences, I think there are two:
The 1st one in my mind is the 'realtiveness' of the URL's.
Directive:
<%@ include file="relativeURL" .... />
Action:
<jsp:include page="relativeRUL" ..... />
For the directive, the file is relative to the current working directory.
For the action, the page is relative to the web app context.
The 2nd:
For the directve, the included resource is processed by the container in the same tranlation unit.
For the action, the translation units are different, i.e. separate compiles ( only if the included resource is .jsp?? - not sure how this works).
What do you think?
Regards, Guy
Niu Xiuyuan
Ranch Hand

Joined: Jun 08, 2001
Posts: 68
but i can compile the file without replacing anything and no errors occours! why?
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
Perhabs a bug in Resin?
You may ask at their website. Would be interesting.
Axel
 
 
subject: the answer is not right?
 
Threads others viewed
errorPage in page directive..
How to determine page type
Custom Error Page
jsp:include Vs include directive
Compilation Error
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture