Brillio interview question

Write code for servlet and what are ways to register a servlet