Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PageContext is not able to get servlet init-param

 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get servlet init-param but it returns null.




I am invoking the tag via corresponding jsp.Tld is declared properly.
I am able to get context parameters but the problem is init params.

please help,

best regards,
omi
[ August 30, 2008: Message edited by: omi sharma ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
context.getServletConfig()

Which servlet do you think it refers to ?
 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it refers to the MovieServlet in which I RequestDispatched to
the jsp where I put the tag.


edited:I considered your hint and I tested the tag class via getServletName() and I surprised to find out it refers jsp.I don't have any servlet named jsp.
I am afraid it refers the jsp where I put the tag because jsp is actually
a servlet.

if this is not a right way then how on earth do I get inits ?

best regards,
omi
[ August 31, 2008: Message edited by: omi sharma ]
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can declare a jsp page in a <servlet> tag! E.g.

|<servlet>
| <servlet-name>movieJsp</servlet-name>
| <servlet-class>/jsp/MoviePage.jsp</servlet-class>
| <init-param>
| <param-name>movie-name</param-name>
| <param-value>Crank 2: High Voltage</param-value>
| </init-param>
|</servlet>

Please let me know if this actually works!
 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan you tried nice , your code does not work but it reminded me to
do this:



Now , it's working fine.

by the way ,crank 2 been released ,I did not know about it
 
Jan Sterk
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope, we have to wait a year for Crank 2

I think my xml was not working because I used <servlet-class> instead of <jsp-file>. The <servlet-mapping> in your code is not necessary I guess.
If you leave it out, it will probably still work..
 
Bobby Sharma
Ranch Hand
Posts: 598
3
Google App Engine jQuery Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yea , it's working without mapping.

well ,I can wait for crank 2 ,writing web pages in java.

best regards,
omi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic