Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where i cud put contex-param

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rancher,
Cud anybody tell me where i cud put context-param in the deployment descriptor,
i tried to put inside servlet tag but it does not work like this
<servlet>
<servlet-name>ServletDemo</servlet-name>
<servlet-class>servletDemo</servlet-class>
<context-param>
<param-name>MyParam</param-name>
<param-value>MyParamValue</param-value>
and i tried to put under web-app also , it does not work out like this
<web-app>
<context-param>
<param-name>MyParam</param-name>
<param-value>MyParamValue</param-value>
</context-param>
<web-app>
. so cud u tell what is location to put the contxt-param .and i am getting the error on cmd prompt saying we cud not put the context param in servlet or some times server does not start.so what cud be problem
thanks in advance
..gaurav
 
Rohit Poddar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The context-param element declares servlet context initialization parameters for a Web Application. So it should be part of <web-app> </web-app>. You set each context-param within a single context-param element, using <param-name> and <param-value> elements. You can access these parameters in your code using the javax.servlet.ServletContext.getInitParameter() and javax.servlet.ServletContext.getInitParameterNames() methods.
I tried it and it works beautifully with Weblogic Server.
Send me your code if it still does not work.
Rohit
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"Cgaurav"
your name doesn't agree with the javaranch guidelines.
please take a moment and re-register after reviewing the
guidelines at http://www.javaranch.com/name.jsp
thanks for your cooperation.
- satya
 
Gaurav Chugh
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
Rohit now its working fine ,and Madhav now i am using the rancher policy for the name .
------------------
with warm regards
..gaurav
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Appreciate your cooperation.
- satya
 
Shamaila Mahmood
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
you have put <web-app> at the end of code instead of </web-app>

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic