当前位置: 首页 > news >正文

怎么做素材网站网站设计工资怎么样

怎么做素材网站,网站设计工资怎么样,合肥网站优化价格,电商网站流程图SpringEL与List,Map 文章目录 SpringEL与List,Map介绍Spring EL以注解的形式Spring EL以XML的形式 介绍 使用SpEL与 Map 和 List 的工作方式与Java是完全一样的 //get map whete key MapA Value("#{testBean.map[MapA]}") private String mapA;//get first value …

SpringEL与List,Map

文章目录

  • SpringEL与List,Map
    • 介绍
    • Spring EL以注解的形式
    • Spring EL以XML的形式

介绍

使用SpEL与 Map 和 List 的工作方式与Java是完全一样的

//get map whete key = 'MapA'
@Value("#{testBean.map['MapA']}")
private String mapA;//get first value from list, list is 0-based.
@Value("#{testBean.list[0]}")
private String list;

Spring EL以注解的形式

在这里,创建了一个HashMap和ArrayList,并添加了一些初始测试数据

package com.yiibai.core;import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;@Component("customerBean")
public class Customer {@Value("#{testBean.map['MapA']}")private String mapA;@Value("#{testBean.list[0]}")private String list;public String getMapA() {return mapA;}public void setMapA(String mapA) {this.mapA = mapA;}public String getList() {return list;}public void setList(String list) {this.list = list;}@Overridepublic String toString() {return "Customer [mapA=" + mapA + ", list=" + list + "]";}}
package com.yiibai.core;import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Component;@Component("testBean")
public class Test {private Map<String, String> map;private List<String> list;public Test() {map = new HashMap<String, String>();map.put("MapA", "This is MapA");map.put("MapB", "This is MapB");map.put("MapC", "This is MapC");list = new ArrayList<String>();list.add("List0");list.add("List1");list.add("List2");}public Map<String, String> getMap() {return map;}public void setMap(Map<String, String> map) {this.map = map;}public List<String> getList() {return list;}public void setList(List<String> list) {this.list = list;}}

执行程序

Customer obj = (Customer) context.getBean("customerBean");
System.out.println(obj);

输出结果:

Customer [mapA=This is MapA, list=List0]

Spring EL以XML的形式

<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd"><bean id="customerBean" class="com.yiibai.core.Customer"><property name="mapA" value="#{testBean.map['MapA']}" /><property name="list" value="#{testBean.list[0]}" /></bean><bean id="testBean" class="com.yiibai.core.Test" /></beans>
http://www.yayakq.cn/news/552377/

相关文章:

  • 上海市住房和城乡建设厅网站客户管理系统的设计与实现
  • 商城开发网站论述电子商务网站的建设
  • 网站建设前台与后台最新技术wordpress检索
  • 建一个网站大概需要多长时间网站在线备案
  • 网站备案查询工具青云 wordpress
  • 华为网站的建设建议书软件开发接单网站
  • 加盟网站制作推广人社部能力建设中心网站
  • 建设初级中学网站万网网站域名
  • 非法网站怎么推广推广营销app
  • c2c网站是什么温州开发网站公司
  • 网站建设私活中能找想开一家相亲网站 怎么做
  • 淘宝做网站wordpress 云服务器配置
  • 移动网站开发教程下载网页美工设计课程标准
  • 网站入口首页网站可以做网站广告
  • 想学做网站学什么教程市场调研ppt
  • 我的世界查建筑网站济南建设工程交易中心
  • jsp网站开发 孟浩pdf哪个行业必须做网站
  • 免费网站收录怎么用ps做网站ui
  • 淘宝网站建设设计模板平面广告设计培训
  • 教育网站官网免费行情网站app下载大全
  • 网站虚拟空间购买wordpress什么删留言
  • 常州建设网站代理商做网站哪些好
  • 马来西亚的网站后缀做基础销量的网站
  • 电子商务网站建设考题与答案国外域名网站推荐
  • 外贸企业网站建设方案上饶便宜的网站建设
  • 房产中介做租单用哪个付费网站更好wordpress 显示评论内容
  • 网站设计模板含数据库网站怎么做百度快照logo
  • 建平台网站费用科技 杭州 网站建设
  • 网站链接数怎么做wordpress新手教程
  • 东莞公司建网站要多少费用简述企业建设网站的必要性