• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

the answer is not right?

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but i can compile the file without replacing anything and no errors occours! why?
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhabs a bug in Resin?
You may ask at their website. Would be interesting.
Axel
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic