我的学习记录134
2018-02-21 09:05
218 查看
2018.2.21李锦浩【连续第134天】
昨天已经学习了如何利用动作指令来对javaBean进行实例化,今天需要学习如何对实例化的javaBean对象进行初始化。
<jsp:setProperty>格式:<jsp:setPropertyname=”javaBean实例名” property=”*”/>
<jsp:setProperty name=”javaBean实例名”property=”javaBean属性名”/>(以上两种跟表单关联)
<jsp:setProperty name=”javaBean实例名”property=”javaBean属性名”value=”BeanValue”/>(手工设置)
<jsp:setProperty name=”javaBean实例名”property=”javaBean属性名” param=”request对象中的参数名”/>(跟request参数关联)
附:<%@ page language="java" import="java.util.*"pageEncoding="utf-8"%><%Stringpath = request.getContextPath();StringbasePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%> <!DOCTYPE HTML PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'dologin.jsp' starting page</title> <meta http-equiv="pragma"content="no-cache"> <meta http-equiv="cache-control"content="no-cache"> <meta http-equiv="expires"content="0"> <meta http-equiv="keywords"content="keyword1,keyword2,keyword3"> <meta http-equiv="description"content="This is my page"> <!-- <link rel="stylesheet"type="text/css" href="styles.css"> --> </head> <body> <jsp:useBean id="myusers" class="javaBean.User"scope="page"/> <h1>setProperty动作使用方法</h1> <hr> <!-- 根据表单匹配所有属性 --> <jsp:setProperty property="*" name="myusers"/> 用户名:<%=myusers.getUsername() %> 密码:<%=myusers.getPassword() %> <!-- 根据表单匹配部分属性 --> <jsp:setProperty property="password" name="myusers"/> 用户名:<%=myusers.getUsername() %> 密码:<%=myusers.getPassword() %> </body>
</html><%@ page language="java" import="java.util.*"pageEncoding="utf-8"%><%Stringpath = request.getContextPath();StringbasePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%> <!DOCTYPE HTML PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'login.jsp' starting page</title> <meta http-equiv="pragma"content="no-cache"> <meta http-equiv="cache-control"content="no-cache"> <meta http-equiv="expires"content="0"> <meta http-equiv="keywords"content="keyword1,keyword2,keyword3"> <meta http-equiv="description"content="This is my page"> <!-- <link rel="stylesheet"type="text/css" href="styles.css"> --> </head> <body> <h1>系统登录</h1> <hr> <form name="loginForm"action="dologin.jsp" method="post"> <table> <tr> <td>用户名</td> <td><input type="text"name="username" value=""/></td> </tr> <tr> <td>密码</td> <td><input type="password"name="password" value=""/></td> </tr> <tr> <td colspan="2"align="center"><input type="submit"value="登录"/></td> </tr> </table> </form> </body>
</html>
明日任务:继续学习javaweb。
昨天已经学习了如何利用动作指令来对javaBean进行实例化,今天需要学习如何对实例化的javaBean对象进行初始化。
<jsp:setProperty>格式:<jsp:setPropertyname=”javaBean实例名” property=”*”/>
<jsp:setProperty name=”javaBean实例名”property=”javaBean属性名”/>(以上两种跟表单关联)
<jsp:setProperty name=”javaBean实例名”property=”javaBean属性名”value=”BeanValue”/>(手工设置)
<jsp:setProperty name=”javaBean实例名”property=”javaBean属性名” param=”request对象中的参数名”/>(跟request参数关联)
附:<%@ page language="java" import="java.util.*"pageEncoding="utf-8"%><%Stringpath = request.getContextPath();StringbasePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%> <!DOCTYPE HTML PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'dologin.jsp' starting page</title> <meta http-equiv="pragma"content="no-cache"> <meta http-equiv="cache-control"content="no-cache"> <meta http-equiv="expires"content="0"> <meta http-equiv="keywords"content="keyword1,keyword2,keyword3"> <meta http-equiv="description"content="This is my page"> <!-- <link rel="stylesheet"type="text/css" href="styles.css"> --> </head> <body> <jsp:useBean id="myusers" class="javaBean.User"scope="page"/> <h1>setProperty动作使用方法</h1> <hr> <!-- 根据表单匹配所有属性 --> <jsp:setProperty property="*" name="myusers"/> 用户名:<%=myusers.getUsername() %> 密码:<%=myusers.getPassword() %> <!-- 根据表单匹配部分属性 --> <jsp:setProperty property="password" name="myusers"/> 用户名:<%=myusers.getUsername() %> 密码:<%=myusers.getPassword() %> </body>
</html><%@ page language="java" import="java.util.*"pageEncoding="utf-8"%><%Stringpath = request.getContextPath();StringbasePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%> <!DOCTYPE HTML PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'login.jsp' starting page</title> <meta http-equiv="pragma"content="no-cache"> <meta http-equiv="cache-control"content="no-cache"> <meta http-equiv="expires"content="0"> <meta http-equiv="keywords"content="keyword1,keyword2,keyword3"> <meta http-equiv="description"content="This is my page"> <!-- <link rel="stylesheet"type="text/css" href="styles.css"> --> </head> <body> <h1>系统登录</h1> <hr> <form name="loginForm"action="dologin.jsp" method="post"> <table> <tr> <td>用户名</td> <td><input type="text"name="username" value=""/></td> </tr> <tr> <td>密码</td> <td><input type="password"name="password" value=""/></td> </tr> <tr> <td colspan="2"align="center"><input type="submit"value="登录"/></td> </tr> </table> </form> </body>
</html>
明日任务:继续学习javaweb。
相关文章推荐
- 虚拟存储器学习记录
- Hadoop学习10--常用命令记录帖
- JAVA学习记录(四)面向对象编程三大特性之封装
- Windows下DOS命令行使用和编程(学习记录)
- 0718学习记录(指针与数组)
- 【Android实战】记录自学自定义GifView过程,详解属性那些事!【学习篇】
- Java 学习记录(二) 从零开始,第一个java程序
- swift 学习记录(二)
- redis学习记录06-pipeline
- Chrome神器Vimium快捷键学习记录
- selenium+phantomJS学习使用记录
- 我的参考文章&学习记录
- JAVA 动态代理学习记录
- python学习--核心编程4习题以及知识点记录
- SpringMVC学习记录(八)--开发中的小问题
- CentOS学习记录(更新中)
- 学习记录--颤抖吧,hadoop(四)---安装Linux系统
- mysql 学习记录(十三)--事务与表锁
- cocos2d学习记录(四)-简单动画
- 和菜鸟一起学linux之dlna的学习记录