Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

the answer is not right?

 
Niu Xiuyuan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but i can compile the file without replacing anything and no errors occours! why?
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhabs a bug in Resin?
You may ask at their website. Would be interesting.
Axel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic