• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

config implicit variable

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On page 217 of the Manning Study Kit,
given the following in web.xml:
<servlet-mapping>
<servlet-name>InitTestServlet</servlet-name>
<url-pattern>/initTest.jsp</url-pattern>
</servlet-mapping>
http://localhost:8080/chapter12/initTest.jsp and
http://localhost:8080/chapter12/InitTestServlet will generate different outputs. But I got exactly the same results, both prints out the init parameters configured in web.xml. ???
Like to share your experience and explainations.
Thanks.
yu chen :roll:
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Yu Chen
Do u have a file named InitTestServlet in ur chap12/WEB-INF/...
cause i don't and this(2nd) link gives me file not found :roll:
wheras the first gives me
Servlet Name = InitTestServlet
Parameter region = North America
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you remove the servlet-mapping from the web.xml? You need to remove that to be able to see the distinct behavior.
 
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have this mapping:
<servlet-mapping>
<servlet-name>InitTestServlet</servlet-name>
<url-pattern>/initTest.jsp</url-pattern>
</servlet-mapping>
Then you should see the same result.
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming your web-app context name is "chapter14", and web.xml is configured like below,

The following 2 requests will produce the same results.
1. http://localhost:8080/chapter12/servlet/InitTestServlet ( Note that "/servlet/" here )
2. http://localhost:8080/chapter12/initTest.jsp
If you just make a request like below, you will get 404 not found error.
http://localhost:8080/chapter12/InitTestServlet
regards,
Maha Anna
[ December 01, 2002: Message edited by: Maha Annadurai ]
 
Police line, do not cross. Well, this tiny ad can go through:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic