• Post Reply Bookmark Topic Watch Topic
  • New Topic

servletConfig gives me null  RSS feed

 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator






I am using servletconfig here, and used initparameter, but this gives me null why?
Screenshot_7.png
[Thumbnail for Screenshot_7.png]
Output is null
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find your lack of proper indentation disturbing.
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



sorry , this is my web.xml with proper indentation.
 
Ron McLeod
Bartender
Posts: 1602
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a couple of things you need to sort out.

First, the configuration in the web.xml has problems: the servlet-class is incorrect (doesn't match your Servlet), and the url-pattern doesn't match what you are typing in the browser (doesn't matter at the moment due to the second issue).

Second, you are using both an annotation and a deployment descriptor. While that is allowed, when you have the errors with one or the other, things can appear to be working, but not completely or as expected. Maybe for now, you should use one or the other. IF you want to specify the init params and other configuration data in the annotation rather than the web.xml file, you can annotate the Servlet like this:

    @WebServlet(name="anyname", urlPatterns={"/servletconfg"},initParams={@WebInitParam(name="Driver", value="trapti")})
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know , "servlet class"(which is given in web.xml) is the package name of servlet ...according to you ,what should be my "servlet- class" in web.xml?
 
sarojni agrwal
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the above reply , actually, the "servlet-class" is somewhat full pacakage name with class name, I got my answer, btw thanks for reply...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!