This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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: 56204
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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: 56204
    
  13

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: 56204
    
  13

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.
 
Similar Threads
Unable to use El in custom tags
Unable to find taglib in project--please help
JSTL Problem deploying on different computer
Can't render JSP
el-ignored query