一 不加filter写成的留言板控制敏感词
1.写表单
<body>
<form action = "commentServlet" method = "post">
username:<input type = "text" name = "username"><br>
comment:<textarea name = "comment">
</textarea><br>
<input type = "submit">
</form>
</body>
2.完成action转向的servlet内容
public class commentServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String username = req.getParameter("username");
String comment = req.getParameter("comment");
username = username.replace("zhang", "li");
comment = comment.replace(&