• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

directive tag

 
Ashu Jain
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I can see that there is no semicolon in page import directive. How come and why.

<%@page import="foo.*" %>

When it got translated to java file then semicolon is required.
Please explain me why semicolon is not required here?
 
cesar valencia
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the translation is a task carried by the container and in only acts upon what the jsp specifaction dictates, in this case:

import An import attribute describes the types that are available to the scripting environment. The value is as in an import declaration in the Java programming language, a (comma separated) list of either a fully qualified Java programming language type name denoting that type, or of a package name followed by the .* string, denoting all the public types declared in that package. The import list shall be imported by the translated JSP page implementation and is thus available to the scripting environment. The default import list is java.lang.*, javax.servlet.*, javax.servlet.jsp.* and javax.servlet.http.*. This attribute is currently only defined when the value of the language directive is java.

hope that helps.
 
Ashu Jain
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is:

1. We use semicolon in declarative and scriplet JSP element type whereas do not use semicolon in expression element type because the value in<%= %> is argument to an out.println().

But why are we not using semicolon in page import directive after all in java class we have something like this

import foo.*; ( with a semicolon ).
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its good for us Compiler does the job for us.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic