• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EPractice Lab mock exam 5 question 38

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
38. You are developing a Java EE application that requires a page to display dynamic chart. Which Java EE component is most suited for the above requirement?
a. Java servlet
b. JSP
c. EJB
d. DAO
Given answer : A
Although servlets and JSP pages can be used interchangeably, each has its own strengths.
Servlets are best suited for service-oriented applications (web service endpoints are implemented as servlets) and the control functions of a presentation-oriented application, such as dispatching requests and handling non-textual data.
- servlets are most effectively used for implementing logic and generating binary content.
-use servlets to implement services.
- servlets are usually not visual components, except for some that generate binary content.
- instead , think of a servlet as an information service provided by an application
- a servlet can perform whatever service it provides- templating , security, personalization, application control- and then select a presentation component (often a JSP page) to which it forwards the request for display.
- use servlets as controllers
-user servlets to generate binary content
-avoid writing servlets that print mostly static text.

JSP pages are more appropriate for generating text-based markup such as HTML, scalable vector graphics, wireless markup language and xml.


I think b is a possible choice because we can use <jsp:include page="dyamicPage.jsp"/> to include dynamic content in a page.
 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the question is asking not just the "display" but the stuff before it: generating the data for the dynamic chart.

If JSP was the correct answer, people may think the JSP will have Java code in it which is indeed not best practice.
 
Chris Barrett
Bartender
Posts: 317
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's tough. As soon as I read "requires a page to display", I thought presentation layer and that JSP was the right answer, too.

I've not done this exam, but for those who have, is the exam as ambiguous as some of the questions Himai has been posting from this mock exam?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic