为了账号安全,请及时绑定邮箱和手机立即绑定

servlet中用StringBuffer的方式输出一个表单输不出来而是输出我的项目名

servlet中用StringBuffer的方式输出一个表单输不出来而是输出我的项目名

慕神4704991 2018-08-04 23:13:02
public class Form extends HttpServlet { private static final long serialVersionUID = 1L;    /**     * Default constructor.      */    public Form() {        // TODO Auto-generated constructor stub    } /**  * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)  */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  // TODO Auto-generated method stub  response.getWriter().append("Served at: ").append(request.getContextPath()); } /**  * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)  */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  // TODO Auto-generated method stub  response.setContentType("text/html;charset=utf-8");  response.setCharacterEncoding("utf-8");  PrintWriter writer = response.getWriter();  StringBuffer buffer = new StringBuffer(); /* <form action=''>  username:<input type='text'>  password:<input type='text'> </form> */  buffer.append("<form action=''>");  buffer.append("username:<input type='text'>");  buffer.append("password:<input type='text'>");  buffer.append("</form>"); }}
查看完整描述

3 回答

?
qq_LONELYPATIEN_33672566

TA贡献4条经验 获得超0个赞

先看你的http请求是什么类型

查看完整回答
反对 回复 2018-08-05
  • 3 回答
  • 0 关注
  • 1220 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信