servlet3.0 可以使用注解,而不用去配置web.xml文件
@webServlet(name="名称",urlPatterns="访问路径")
@WebServlet(name = "BServlet",urlPatterns = "/BServlet")
public class BServlet extends HttpServlet {protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String username=request.getParameter("username");System.out.println("username"+username);request.getSession().setAttribute("username",username);response.sendRedirect("char.jsp");}