标签:开始 pack date style color 表达式 快速 type bean
1 package com.chan.basic.domain; 2 3 /** 4 * Created by Chan on 2017/3/21. 5 */ 6 public class Family { 7 private String wife; 8 private String cat; 9 private String children; 10 private String dog; 11 12 public String getWife() { 13 return wife; 14 } 15 16 public void setWife(String wife) { 17 this.wife = wife; 18 } 19 20 public String getCat() { 21 return cat; 22 } 23 24 public void setCat(String cat) { 25 this.cat = cat; 26 } 27 28 public String getChildren() { 29 return children; 30 } 31 32 public void setChildren(String children) { 33 this.children = children; 34 } 35 36 public String getDog() { 37 return dog; 38 } 39 40 public void setDog(String dog) { 41 this.dog = dog; 42 } 43 }
1 <%@ page import="com.chan.basic.domain.Family" %> 2 <%-- 3 Created by IntelliJ IDEA. 4 User: Administrator 5 Date: 2017/3/22 6 Time: 17:49 7 To change this template use File | Settings | File Templates. 8 --%> 9 <%@ page contentType="text/html;charset=UTF-8" language="java" %> 10 <html> 11 <head> 12 <title></title> 13 </head> 14 <body> 15 <% 16 //NEW 17 Family me =new Family(); 18 //SET 19 me.setDog("Tom"); 20 me.setWife("Jack"); 21 me.setChildren("James"); 22 me.setCat("Tomcat"); 23 //REQUEST 24 request.setAttribute("myFamily",me); 25 %> 26 <h1>使用EL表达式,秒杀你</h1> 27 <%--request应为requestScope--%> 28 ${requestScope.myFamily.cat} 29 </body> 30 </html>
标签:开始 pack date style color 表达式 快速 type bean
原文地址:http://www.cnblogs.com/chanchifeng/p/6601716.html