doGet()方法来处理浏览器直接访问和get方式提交的表单
来源:互联网 发布:java读取配置文件参数 编辑:程序博客网 时间:2024/05/22 17:42
新建UserForm.jsp:
<%@ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body> <%-- 表单,提交方式为get,提交到doGet--%>> <form action="doGetDemo" method="get"> 用户名:<input type="text" name="username"/><br> 密码:<input type="password" name="password"/><br> <input type="submit" value="提交"/> <input type="reset" value="重置"/> </form></body></html>
新建doGetDemo类:
package web_project;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class doGetDemo extends HttpServlet{ //doGet方法 public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{ // response.setContentType("text/html;charset=gb2312"); PrintWriter outp=response.getWriter(); // request.setCharacterEncoding("gb2312"); // String username= request.getParameter("username"); // String password=request.getParameter("password"); outp.println("<html>"); outp.println("<body>"); outp.println("用户名:"+username+"<br>"); outp.println("密码"+password); outp.println("</body>"); outp.println("</html>"); }}
0 0
- doGet()方法来处理浏览器直接访问和get方式提交的表单
- jsp servlet 乱码处理方法-表单提交的 pos 和get 方式
- get方法提交表单的乱码处理
- 表单的提交方式POST和GET
- 表单的提交方式:get和post
- 用get方式提交form表单的中文处理方式
- 表单通过get和post方式提交数据解决乱码的方法
- javaweb浏览器get方式提交中文处理
- 表单的提交方式get和post的区别
- 表单的提交方式POST和GET的区别
- 表单提交中Get和Post方式的区别
- 表单提交中get和post方式的区别
- 表单提交中get和post方式的区别
- 表单的提交方式POST和GET有什么区别
- 表单提交中Get和Post方式的区别
- 表单的提交方式POST和GET有什么区别
- 表单提交中Get和Post方式的区别
- 表单提交中Get和Post方式的区别
- 去掉String字符串的最后一个字符
- Java集合框架:总结
- adb logcat 命令行用法
- 移动端H5做一个不限个数的通栏按钮 by FungLeo
- java中图片格式转换
- doGet()方法来处理浏览器直接访问和get方式提交的表单
- 实现在CMD中用命令运行apache
- JS Date函数处理
- sqlite 快速入门
- va_start和va_end使用详解
- org.hibernate.LazyInitializationException: could not initialize proxy - no Session
- android布局的一些知识
- clock()、time()、clock_gettime()和gettimeofday()函数的用法和区别
- C++11 override 和 final