• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parsing servlet

 
Jay X Brown
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm trying to write a servlet that parses an xml file and then hits the database.
do i extend HTTPServlet or HandlerBase?
i feel i should know this by now. don't know why i'm confused.
thanks in advance for the help.
jb
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your servlet should extend HTTPServlet, and I recommend that you create one or more support classes to do your XML parsing and database access. Your parser class(es) can then extend HandlerBase.
In my experience one of the most common mistakes with using servlets is to assume that all the code must be written "inside" the servlet. A servlet is just a java class, and should be made no bigger than it needs to be to handle and process HTTP requests and parameters, and dispatch to appropriate processing in other classes.
 
Jay X Brown
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much, Frank.
That was my hunch as well but I was not sure.
JB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic