struts2 s:select value ognl 表达式 [英] struts2 s:select value ognl expression
本文介绍了struts2 s:select value ognl 表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 s:select
的 Struts2 教程中 我见过的标签:
In Struts2 tutorial for s:select
tag I've seen:
<s:select label="Pets"
name="petIds"
list="petDao.pets"
listKey="id"
listValue="name"
multiple="true"
size="3"
required="true"
value="%{petDao.pets.{id}}"
/> ^ ^
还有我的问题:为什么是 value="%{petDao.pets.{id}}"
?为什么不简单地value="%{petDao.pets.id}"
?那些尾随花括号是什么意思?
and my question: why value="%{petDao.pets.{id}}"
? why not simply value="%{petDao.pets.id}"
? what do those trailing curly braces mean?
推荐答案
这是一个 OGNL 列表投影 以从petDao.pets
中获取所有id
值作为列表,这意味着此
将被预选.
This is an OGNL list projection to get all the id
values as a list from petDao.pets
, meaning all values in this <s:select>
will be pre-selected.
这篇关于struts2 s:select value ognl 表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文