aspose file tools*
The moose likes Servlets and the fly likes Head First Book : why are we using this ? The code works without it. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Head First Book : why are we using this ? The code works without it." Watch "Head First Book : why are we using this ? The code works without it." New topic
Author

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

Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

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 ?


SCJP 6. Learning more now.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61623
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rahul Sudip Bose
Ranch Hand

Joined: Jan 21, 2011
Posts: 637

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

Joined: Jan 10, 2002
Posts: 61623
    
  67

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

Joined: Jan 21, 2011
Posts: 637

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

Joined: Jan 10, 2002
Posts: 61623
    
  67

A good example then of something that will bite you later on if you are sloppy.

The EL is the JSP Expression Language.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head First Book : why are we using this ? The code works without it.