标题:JSP嵌入EL表达式
只看楼主
liumian1990
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-8-14
 问题点数:0 回复次数:6 
JSP嵌入EL表达式
我想在jsp页面里使用EL表达式的值做一个减法运算, ${tmp.id.rainDate}-${cropPlant},其中rainDate,cropPlant都是java.util.Date型,
例如rainDate是2012-05-06,cropPlant是2012-05-05,想在单元格里显示 1 ,可是得到的确是2012-05-06 - 2012-05-05,各位高手帮忙看看
怎么解决?
<table width="960" border="1" bordercolor="#999999" cellpadding="0" cellspacing="0">

                            <colgroup span="17" style="FONT-WEIGHT:bold; FONT-SIZE:12px; COLOR:#003366">
                            </colgroup>

                            <logic:iterate name="ls" indexId="index" id="tmp">
                                <tr>
                                    <TD width="212" style="WIDTH: 100px">
                                        ${tmp.id.rainDate }
                                    </TD>
                                    <TD width="190" style="WIDTH: 50px">
                                        ${tmp.id.rainDate}-${cropPlant}
                                    </TD>
                                    <TD width="135" style="WIDTH: 50px">
                                        ${tmp.id.rainValid }
                                    </TD>
                                    <TD width="135" style="WIDTH: 50px">
                                        ${tmp.id.irrigationData }
                                    </TD>
                                    <TD width="135" style="WIDTH: 50px">
                                        ${tmp.id.etData }
                                    </TD>
                                    <TD width="139" style="WIDTH: 50px">
                                        ${tmp.id.humidityData }
                                    </TD>
                                </tr>
                            </logic:iterate>
                        </table>
搜索更多相关主题的帖子: border 表达式 jsp 
2012-09-15 21:55
liumian1990
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-8-14
得分:0 
没人顶啊,我自己顶....
2012-09-15 22:03
liumian1990
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-8-14
得分:0 
顶啊,别让 沉了
2012-09-16 21:10
liumian1990
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-8-14
得分:0 
${(tmp.id.rainDate.time-cropPlant.time)/(1000*60*60*24)}这样就可以类
2012-09-16 21:31
cn1314
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-9-26
得分:0 
自娱自乐啊小子,我觉得你再后台计算出了再页面上取比较实在
2012-09-26 17:32
szgg520
Rank: 5Rank: 5
等 级:职业侠客
威 望:3
帖 子:79
专家分:307
注 册:2011-6-13
得分:0 
这个简单呀

[url=http://www.]深圳复印机出租[/url]
2012-09-27 22:25
leesanchuan
Rank: 2
等 级:论坛游民
威 望:1
帖 子:11
专家分:27
注 册:2012-10-24
得分:0 
${(tmp.id.rainDate-cropPlant)}  这样就ok
2012-10-24 09:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-381478-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.811900 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved