Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First Book : why are we using this ? The code works without it.

 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I replace the below stuff with <web-app> and all my code works. Why should i add all the lines as shown in the book ?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64980
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because without it, the container doesn't know much about what level of servlet support you intend to use and will use defaults that may not be what you intend. Just because it hasn't kicked you in the ass yet, doesn't mean it won't at some point.

Just because "something works" is no excuse for sloppiness.
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Because without it, the container doesn't know much about what level of servlet support you intend to use and will use defaults that may not be what you intend.


What is meant by "servlet support" (have not come across it yet) ? What is that whole thing called - so that i can put that word in google and read more about it ?

Bear Bibeault wrote:
Just because it hasn't kicked you in the ass yet, doesn't mean it won't at some point.


Hope it never happens. Can you give me an (real-world) example where it may cause problems ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64980
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example, if you incorrectly declare the deployment descriptor to use Servlets 2.3, the EL is disabled by default in JSPs.

And again, even if "things work", it's best to be explicit as a good practice. That way, you and everyone else knows what the intentions of the code are.
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
the EL is disabled by default in JSPs.


Sorry, this may sound foolish but what is this EL ? Never saw such things in my book.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64980
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good example then of something that will bite you later on if you are sloppy.

The EL is the JSP Expression Language.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic