EL表达式(一)

来源:互联网 发布:淘宝店铺宣传团队抽成 编辑:程序博客网 时间:2024/06/06 14:11
<%@page import="java.util.Date"%>
<%@page import="com.test.Customer"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>


time:${time}<br/>
time:${applicationScope.time}<br/>
time:<%=application.getAttribute("time") %>
<%
  request.setCharacterEncoding("UTF-8");
%>
<form action="el.jsp" method="post">
userName:<input type="text" name="username" value="<%=request.getParameter("username")==null?"":request.getParameter("username")%>"/><br/>
userName:<input type="text" name="userName" value="${param.username}"/><br/>
   <input type="submit" value="Submit"/><br/>
   userName:<%=request.getParameter("username")==null?"":request.getParameter("username") %>
   <br/><br/>
   <jsp:useBean id="customer" class="com.test.Customer" scope="session"></jsp:useBean>
   <jsp:setProperty property="age" value="20" name="customer"/>
  age:<%
  Customer customer2=(Customer)session.getAttribute("customer");
   out.print(customer2.getAge());
  %><br/>
  age:<jsp:getProperty property="age" name="customer"/><br/><br/>
  <a href="el2.jsp?score=89&name=A&name=B&name=C">To El2 Page</a>
  <%
  application.setAttribute("time", new Date());
  %> 
</form>
</body>
</html>
0 0
原创粉丝点击