html页面显示java后台传递的对象

#html页面获取java后台传递的对象
springboot+themleaf
######使用EL表达式
在前台el表达式中,获取后台传的实体对象集合的值 例如:th:text=${entity.id}
是先通过取实体类的id成员 如果成员是private 继续通过getID()方法取id值
所以entity.id的名称不能随便乱取,要按照id成员的get方法取
######前台代码

<th th:text="${ofd.id}">订单编号</th>
<th th:text="${ofd.ywType}">业务类型</th>
<th th:text="${ofd.orderType}">订单类型</th> 
<th th:text="${ofd.price}">订单金额</th> 

######定义的类的部分代码

	private int id;//订单编号
	private String ywType;//业务类型
	private String orderType;//订单类型
	private float price;//订单金额
	/**
	省略其它代码
	*/
	public int getId(){
		return this.id;
	}
	public String getYwType(){
		return this.ywType;
	}
	public String getOrderType() { 
		return orderType;
	}
	public float getPrice(){
		return this.price;
	}
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值