Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

config implicit variable

 
Yu Chen
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:
 
taash mg
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
 
Tracy Woo
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.
 
Bruce Jin
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.
 
Maha Annadurai
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic