aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Where i cud put contex-param Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Where i cud put contex-param" Watch "Where i cud put contex-param" New topic
Author

Where i cud put contex-param

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Aug 18, 2001
Posts: 36
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

SCJP, SCWCD
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

"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

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Gaurav Chugh
Ranch Hand

Joined: Aug 28, 2001
Posts: 50
Hi there,
Rohit now its working fine ,and Madhav now i am using the rancher policy for the name .
------------------
with warm regards
..gaurav


Regards<br />gaurav..
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Appreciate your cooperation.
- satya
Shamaila Mahmood
Greenhorn

Joined: Aug 28, 2001
Posts: 16
hi
you have put <web-app> at the end of code instead of </web-app>

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Where i cud put contex-param