• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JSP page directive -- multi import attributes?

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the following correct (with multi import attributes)?

<%@ page import=”java.util.List” import=”java.util.ArrayList” %>
 
Ranch Hand
Posts: 138
Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think so.

You can place multiple imports as comma seperated in a single import attribute.
 
Joe Allen
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for responding. I don't think so either. It is in Nikos mock exam. See below:

8.Which of the following are syntactically valid? (2 correct answers)
1.<%@ page import=”java.util.List : java.util.ArrayList” %>
2.<%@ page import=”java.util.List , java.util.ArrayList” %>
3.<%@ page import=”java.util.List” import=”java.util.ArrayList” %>

Correct answer: 8.b, c (2,3)
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answer B (<%@ page import=”java.util.List , java.util.ArrayList” %> ) is correct and the answer C is not correct.
 
Joe Allen
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. It must be an errdata in the mock exam.
 
Joe Allen
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, <%@ page import=”java.util.List” import=”java.util.ArrayList” %> is considered "technically correct". I found this out when I was doing Enthuware tests. See the explanation below:

"Technically, an import attribute can occur multiple times in a page. It is clear that it is valid to have multiple page directives with import attribute. However, it is not clear from the specification whether import attribute can occur multiple times within the same page directive. Ideally, specifying the same attribute twice in the same directive should cause translation error. However, some containers are forgiving and accept it as valid.

Here is an old bug report for Tomcat that you might find interesting : https://issues.apache.org/bugzilla/show_bug.cgi?id=4022";

The above is quoted from Enthuware.
 
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Joe wrote: Here is an old bug report for Tomcat that you might find interesting : https://issues.apache.org/bugzilla/show_bug.cgi?id=4022";



Very interesting indeed. Thank you for the share.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic