About Question enthuware.jwpv6.2.981 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
Ciprian Mihalache
Posts: 51
Joined: Wed Sep 28, 2011 12:14 pm
Contact:

About Question enthuware.jwpv6.2.981 :

Post by Ciprian Mihalache »

<%@ page import="java.util.*" import="java.text.*"%>
import is an attribute and can occur only once inside a page directive.
Are you sure about this? On my PC I have Tomcat and it works like a charm. The documentation states about the import :
There shall be only one occurrence of any attribute/value pair defined by this directive in a given translation unit, unless the values for the duplicate attributes are identical for all occurrences. The import and pageEncoding attributes are exempt from this rule and can appear multiple times.
Multiple uses of the import attribute are cumulative (with ordered set union semantics).
but indeed is not very specific if multiple import can be defined in a single page directive, or in multiple directives in the same page.
An old Tomcat bug address the same issue: https://issues.apache.org/bugzilla/show_bug.cgi?id=4022
Anyway, the explanation as it is is not correct.

admin
Site Admin
Posts: 10045
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.981 :

Post by admin »

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. (Which is what the tomcat bug report mentions as well.)

The explanation has been modified accordingly.

thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests