• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getServletConfig().getInitParameter("name2") returns null in a forwarded servlet

 
Serafim Plishas
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I start servlet Transit1 and forward it to Transit2
both take their paramete from ServletConfig (this.getServletConfig().getInitParameter("MyParam");)
the output is:

--- Transit2 ---
Trans 1 : Transit N1
Trans 2 : null

why null?

web.xml:


firs servlet - Transit1.java:


second servlet - Transit2.java:
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2531
112
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

--- Transit2 ---
Trans 1 : Transit N1
Trans 2 : null

why null?

I would expect it to throw a HTTP Status 404 - page not found.

You servlet-mapping shows:
and therefore the code in your Transit1 Servlet should be:

 
Serafim Plishas
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank your! in works!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic