request.setAttribute("username", username);//一定要保存,OGNL才能获取${username}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
String username= request.getParameter("username");
request.setAttribute("username", username);//一定要保存,OGNL才能获取${username}
//也可以保存在session中,但是好像视频说不好
//或者直接在jsp页面中用<%=request.getParameter("username")获取,两种结果一样,但是后者有null
request.getRequestDispatcher("/dologin.jsp").forward(request, response);
}
request.setAttribute("username", username);//一定要保存,OGNL才能获取${username}的更多相关文章
- request.getAttribute( "result");和request.setAttribute("result",username);
request.setAttribute("result",username);在request对象中加入名为result的属性并附值为username,因为request对象是可 ...
- 如何获得 request, "request.getSession(true).setAttribute("a",a);"与“request.setAttribute("a",a);”区别
protected ServletContext getServletContext() { return ServletActionContext.getServletContext();} pro ...
- request.setAttribute和request.getAttribute还有session.setAttribute和session.getAttribute还有request.getParameter和request.getAttribute区别和联系
1.session.setAttribute()和session.getAttribute()配对使用,作用域是整个会话期间,在所有的页面都使用这些数据的时候使用. 2.request.setAttr ...
- request.getParameter()与request.setAttribute()的区别 (转载)
request.getParameter()与request.setAttribute()的区别 request.getParameter(),request.setAttribute()区别如下: ...
- request.setAttribute()、session.setAttribute()和request.getParameter()的联系与区别(记录)
1.session.setAttribute()和session.getAttribute()配对使用,作用域是整个会话期间,在所有的页面都使用这些数据的时候使用. 2.request.setAttr ...
- request.getSession().setAttribute("",..)和request.setAttribute("",...)的差别
request.getSession.setAttribute()是获得当前会话的session,然后再setAttribute到session里面去,有效范围是session而不是request. ...
- request.setAttribute()、session.setAttribute()和request.getParameter()的联系与区别
1.session.setAttribute()和session.getAttribute()配对使用,作用域是整个会话期间,在所有的页面都使用这些数据的时候使用. 2.request.setAttr ...
- javaweb: request.getParameter()、request.setAttribute()与request.getAttribute()的作用 (转)
出处:https://blog.csdn.net/qq_41937388/article/details/87972914 1.request.getParameter()方法是获取通过类似post, ...
- request.setAttribute()用法
小问题: JSP1代码 String [] test=new String[2]; test[0]="1"; test[1]="2"; request.setA ...
随机推荐
- Android studio怎么修改文件名
选中需要重新命名的文件 点击Android studio菜单中列表中的Refactor的选项 选择下拉菜单中的“rename”的选项 弹出rename的选项框,在输入框中输入需要重新的命名的名称. 点 ...
- appium server日志分析
文章出处http://blog.csdn.net/yan1234abcd/article/details/60765295 每次运行测试,可以从Appium Server控制台看到有特别多的日志输出, ...
- python中self cls init的理解
原创文章,未经允许禁止转载! python中self cls init的理解 python中self cls init的理解
- python全栈开发从入门到放弃之元组的内置应用
1.元组的字符类型tuple t=(1,[1,3],'sss',(1,2)) print(type(t)) <class 'tuple'> 2.按索引号取值 t=(1,[1,3],'sss ...
- netty应用
http://www.blogjava.net/yongboy/archive/2013/05/13/399203.html http://shentar.me/tag/netty-2/ 代理 htt ...
- js获取iframe和父级之间元素,方法、属,获取iframe的高度自适应iframe高度
摘自:http://blog.csdn.net/kongjiea/article/details/38870399 1.在父页面 获取iframe子页面的元素 (在同域的情况下 且在http://下测 ...
- nginx ip无法访问
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤. 1.关闭firewall: systemctl stop firewalld.service #停止f ...
- MySQL-5.7 游标及DECLARE
1.cursor游标 用来声明一个数据集 游标的声明必须在变量和条件声明之后,在handler声明之前 游标特性: 不灵敏:服务器可以或不复制其结果 只读:不可更新 不可滚动的:只能在一个方向上遍历, ...
- jQuery/CSS3 3D焦点图动画
在线演示 本地下载
- git 强制放弃本地修改(新增、删除文件)【转】
本文转载自:https://blog.csdn.net/u012672646/article/details/56676804 本地修改了一些文件,其中包含修改.新增.删除的,不需要了想要丢弃,于是做 ...