Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

config implicit variable

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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 ]
 
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic