Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Vengan Krish

Ranch Hand
+ Follow
since Mar 05, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vengan Krish

I don't see anything wrong in option 1.
But obviously option 5 would fail during compilation of the translated jsp class.
Here is how the translated code would look like with option 5 in a JSP.



Please note the statement ht.put("max", "10"); is invalid in a class body without opening/closing braces.

Regards
Check out the section SRV.8.4.2 in the servlet spec.

Regards
Answer B is correct.
Only when you return EVAL_BODY_INCLUDE your body will be processed.
You return EVAL_BODY_PROCESSED when you need access to the body for your own manipulation.
Check out the lifecycle chart on HFS page 533.

Regards.
With 8 hours per day, between now and July 20, there is more than enough time.
you should be good.

Good luck...
This is an error in the book. What you answered is correct.
Check the errata at

web page

Regards
Servlet Spec.
I believe there are 2 key points to be remembered on this subject -
1.Tags that can have dynamic attributes need to declare dynamic_attribute in the DD
2.The corresponding tag handler need to implement DynamicAttributes interface.
Yes.
You can call a tag without a body even when body-content is defined as non-empty.
I guess there is some mock exam question in HFS that highlights this possibility.
Hi,
I got the same question in some mock exam and the answer given was A D B C.

Regards
Your question is unclear. Try to rephrase it and post in a new thread - somebody could help you. If it is some mock exam question, please post the exact question.
I can't get it any better - sorry.
My matrix in the above posting is messed up.

DD <url-pattern> DD <servlet-name>

Filter 1 /Recipes/* -
Filter 2 - /Recipes/HopsList.do
Filter 3 /Recipes/Add/* -
Filter 4 - /Recipes/Modify/ModRecipes.do
Filter 5 /* -
Hi Vishwa,

1. How can a <servlet-name> tag in a filter definition contain an url-pattern? Is it not supposed to contain the name of the servlet to which the filter applies?
Your initial posting has a mistake. Filter 2 mapping has <servlet-name> in the HFS book, not <url-pattern>.

2. The url-pattern /* (the last one) is defined as the last. So this filter would be included in every request but only as the LAST!. Isn't it?
No.

Here is the filter spec in the DD in a matrix.

DD <url-pattern> DD <servlet-name>

Filter 1 /Recipes/* -
Filter 2 - /Recipes/HopsList.do
Filter 3 /Recipes/Add/* -
Filter 4 - /Recipes/Modify/ModRecipes.do
Filter 5 /* -


Let's say we get a request URL /Recipes/HopsList.do.

Applying rule 1, Container goes thro' the <url-pattern> column looking for match. Filter 1 and 5 match.

Applying rule 2, Container goes thro' the <servlet-name> column. Filter 2 match.

So the order is 1 5 2. Isn't it straightforward ?

Makes sense?
Please see the Container's rules for ordering filters in Page 678.

1.Filters with matching URL patterns are placed in the chain in the order they are declared.

2.Next Filters with matching <servlet-name> are placed in the order they are in DD.

Hope this helps.
This is really a huge 'gotcha'.

Regards
I guess some mistach with your directory structure. if you haven't figured it yet, paste your development directory structure here.

regards