开发者学堂课程【Java Web开发系列课程 - Struts2框架入门:OGNL 在项目中的运用】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/537/detail/7310
OGNL 在项目中的运用
目录:
一.usersys_ognllist 代码
二.update 中修改标签
三.Temp
一、usersys_ognllist 代码
<%@ page language="java"import="java.util.*'pageEncoding="UTF-8"%><%@ taglib prefix="s" uri= "/struts-tags"%>String path = request.getContextPath();String basePath =request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><base href= "<%=basePath%>"><title>My JSP'index.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">--〉
用户名:
<input type="text"name="user.name"value="${user.name}"/><br>
密码:
<input type="password"name="user.pwd"value="${user.pwd}"/><br></head><body>
<form action="update.action"method="post”〉<input type="hidden"name="user.id"value='<s:property value="ul"/>'/</form></body></html〉
二、update 中修改标签
<td>密码</td>
<td>操作</td〉
</tr>
<s:iterator value="list"var="bean "
<tr>
<td><s:property value="bean.id"/></td>
<td><s:property value="bean.name"/></td>
<td><s:property value="bean.pwd"/></td>
<td><a href= "toUpdate?user.id=${bean.id}“修改</a></td>
</tr></s:iterator></table></body>
注:登录时不显示名字和密码,只显示修改
修改表达式:<td><s:property value="id"/>k/td>
<td><s:property value="name"/></td>
<td><s:property value="pwd"/>/td>
三.temp
temp 前加#表示它本身