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

Getting Null Value

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there ,
When i try to get the initilization parameter in the servlet file , i am getting as null , i have defined in the deployment descriptor like this and i am using such code
ServletContext context = getServletContext();
String strParamValue = context.getInitParameter("FileName"); and in web.xml file it is like
<servlet>
<servlet-name>
<init-param>
<param-name>FileName</para-name>
<param-vlue>MyFile</param-value>
</init-param>
</servlet>
so cud u tell me why i am getting null values i shd get "MyFile " in the strParamValue i suppose ,and i tried by using this also
String strParamValue = getInitParameter("MyFile");
the same thing is happening here also so cud what cud the problem and how to get all those values.
thanks in advance
..gaurav
 
Armand Aquino
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if that is a cut and past of your code, this line makes the xml document not well formed:
<param-vlue>MyFile</param-value>
value is spelled "vlue"
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now i got it correctly , the problem being i was wrongly putting the context-param in the web.xml file ,when i put this one under <web-app</web-app> , its worked fine and earlier i was putting inside the <servlet></servlet> tag.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic