• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

url-pattern example

 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source of question is www.examulator.com mock

Given that a servlet is correctly declared with the tag

<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>com.examulator.HelloWorld</servlet-class>
</servlet>
Which of the following represent the correct syntax for mapping a servlet url to a servlet name

a)
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>hello</url-pattern>
</servlet-mapping>

b)
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>*.java</url-pattern>
</servlet-mapping>

c)
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

d)
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/com.examulator.HelloWorld</url-pattern>
</servlet-mapping>



which are correct.
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which do you think is correct and why?
 
Bala'J'i Rags
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi chintu ,

My options are b,c,d

b- extension match

d- is an examples for exact match

c-is similar to default macth when we say /*


Please correct me if iam worng
[ August 19, 2008: Message edited by: Bala'J'i Rags ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic