Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confused with JSP Directive page syntax

 
Srinivasa Gundapu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the code snippet I used.
<%@ page import="java.util.*, java.lang.*, java.text.* " ; %>
The semi colon at the end is not throwing errors or exception. It is allowing me to go ahead. Is this acceptable. Or is the container lenient.
BTW I am used weblogic 6.1
Please clarify.
Thanks,
Srinivas
 
Kevin Mukhar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srinivasa Gundapu:
Here is the code snippet I used.
<%@ page import="java.util.*, java.lang.*, java.text.* " ; %>
The semi colon at the end is not throwing errors or exception. It is allowing me to go ahead. Is this acceptable. Or is the container lenient.

The semicolon at the end of the directive is not needed. The import used with the page directive is not a line of code. It is an attribute of the page directive. Just like an HTML attribute or an XML attribute, you do not need to put a semicolon at the end of an attribute.
 
Srinivasa Gundapu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kevin,
My question is why is it not throwing error or exception when I inserted a semicolon after attribute value. We are not supposed to put semicolons after the attribute values.
Is the application server lenient or will the jsp container ignore the semi colon at the end.
Thanks,
Srinivas
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not legal. Most containers are more lenient than the spec, by allowing variations in syntax such as you posted, not insisting on the proper order of elements in web.xml, and a gazillion other ways. Don't let that confuse you.
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic