servlet
Posted zhuxiang1633
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了servlet相关的知识,希望对你有一定的参考价值。
1.servlet基本使用方法
获取参数信息:
@WebServlet("/register") public class RegisterServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); String username = request.getParameter("username"); String phone = request.getParameter("username"); String pwd = request.getParameter("username"); String[] hobby = request.getParameterValues("hobby");//获取复选框值 String gender = request.getParameter("gender"); String course = request.getParameter("course"); response.getWriter().print("hello"); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } }
以上是关于servlet的主要内容,如果未能解决你的问题,请参考以下文章