• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Q.20 from Head First Chapter-9 Scriptless JSP

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys


This is Q.20 from Head First Chapter-9 Scriptless JSP.

The correct answers are C and D.

Why is choice D correct?


A web based application for a major online movie rental retailer stores a
List<Movie> as a session attribute to contain movies the user has requested.

A random, embedded movie trailer from this list must display on the users’
main page every time the users’ main page is viewed.

Management thinks a similar feature will be needed in the near future on
other pages that display lists of movies. Streaming video is accomplished with
regular HTML, just like adding images to a page but with more complex tags.

The development team needs a solution that is both flexible and maintainable.

One possible solution is to create an EL function. The following statements
are from a team meeting concerning EL functions as a solution to this
problem. Which statements are true?

(Choose all that apply.)

A. EL functions can not solve this problem because they can not retrieve
session attributes.
B. The method implementing the EL function should not be declared
static to give it access to session scope.
C. The EL function can accept a parameter of java.util.List
which will allow the needed movie list to be passed to it using EL.
D. You might have to write HTML tags in the middle of Java code using
an EL function, which is more difficult to maintain.
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 2 parts in option D, one says that you'll have to put HTML inside java code and the other says HTML within java code is difficult to maintain. Which part of this is not clear to you can you please tell...
 
James Winfrey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ankit. I have doubt in putting HTML inside Java. We can call the jsp.
 
Ranch Hand
Posts: 40
Android Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James

Let's assume that to stream the video on the homepage, you have to use an HTML tag such as

Now, if you want to write an EL function, it'll have to create the <video> tag using Java code. For example:



This is what option D is referring to. Now, if in future the video tag's attribute names change, you'll have to modify your EL function and recompile your code.

Hope it helps!
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic