This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

JSP page directive -- multi import attributes?

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
This will take every ounce of my mental strength! All for a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic