• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tricky Mock Question

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(I dont think there are 3 valid answers - only D E)

Which three are valid URL mappings to a servlet in a web deployment descriptor?
(Choose three.)
A. */*
B. /*.do
C. myServlet
D. /Myservlet
E. /MyServlet/*
F. MyServlet/*.isp
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A crazy thought. Can we use a URL ../myappl/*.do - the URL contains the * character?
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option b is also correct.
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why? what does B map to?

As a matter of fact, tomcat gives me this when I deploy with a mapping like B

java.lang.IllegalArgumentException: Invalid <url-pattern> /*.do in servlet mapping
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about option C. It could be right.
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you get this question from This is what I had got in my exam. I answered B,D and E and got it right
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand how B could be right.
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too thought it was crazy, but I could not select the other options as they seemed very wrong (apart from the other 2 correct ones)
 
Annie McCall
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I tried all of the them and looks like there are only 2 correct answers - D & E.

I tried /*.do on tomcat and got the same error Alec got.

 
Will Lee
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I remember the HFSJ said that for url pattern, if you use path, it must start with "/", or you can use wild cast (*.do) with no start "/". So how answer B could be right?

Don't have book in hand, so I don't know if my memory is "stale"
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah yeah....my answer would be D & E .

i think i saw this question somewhere....

why choice B is correct?

is

/*

same as

/*.do

...because .do just a convention, so not be a problem???

for me, answer D & E.
[ September 28, 2005: Message edited by: Nicky Eng ]
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to me only there are two valid answers as been discussed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic