Topic: 在struts里怎么写Value

  Print this page

1.在struts里怎么写Value Copy to clipboard
Posted by: 老刀
Posted on: 2003-06-18 20:15

<logic:equal name="pageForm" property="centerID" value="<bean:write name='componentForm' property='centerID'/>">
<tr class="embedDataLevel1" onMouseOver="mouseOver(this);" onMouseOut="mouseOut(this);">
<td><bean:write name="componentForm" property="resourceID" filter="true"/></td>
<td><bean:write name="componentForm" property="resourceQty" filter="true"/></td>
<td><bean:write name="componentForm" property="rowDesc" filter="true"/></td>
</tr>
</logic:equal>

请教高手,value是变量,上以写法不能工作,用什么方法解决没有?thanks

2.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: 老刀
Posted on: 2003-06-18 21:40

没办法,只好用javascript解决。 有朋友知道的请回个贴。

3.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: 老刀
Posted on: 2003-06-19 10:34

问题解决,但是还是不够完美,供大家参考。
<logic:iterate id="componentForm" name="components" property="forms">
<!--
<script>
workCenterComponentPresent("<bean:write name='pageForm' property='centerID' filter='true'/>",
"<bean:write name='componentForm' property='centerID' filter='true'/>",
"<bean:write name='componentForm' property='resourceID' filter='true'/>",
"<bean:write name='componentForm' property='resourceQty' filter='true'/>",
"<bean:write name='componentForm' property='rowDesc' filter='true'/>")
</script>
-->
<!--
Because the logic:equal tag cannot evaluate the value variable from HTML scripts, so must evaluate
the value variable on server side script<set the value as Java variable>, there are two steps:
1. define a bean<attribute> named centerid for the current loop's center ID
2. define a String variable named currentID, and assigned the value from the defined attribute centerid
3. begin the logic:equal tag, and set the value as: "<\%= currentID \%>"
-->
<bean:define id="centerid" name="componentForm" property="centerID" scope="page" type="java.lang.String"/>
<%
String currentID = (String) pageContext.getAttribute("centerid");
%>
<logic:equal name="pageForm" property="centerID" value="<%= currentID %>">
<tr class="embedDataLevel1" onMouseOver="mouseOver(this);" onMouseOut="mouseOut(this);">
<td><bean:write name="componentForm" property="resourceID" filter="true"/></td>
<td><bean:write name="componentForm" property="resourceQty" filter="true"/></td>
<td><bean:write name="componentForm" property="rowDesc" filter="true"/></td>
</tr>
</logic:equal>
</logic:iterate>

4.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: dapan
Posted on: 2003-06-19 11:15

好像只能如此?不知有无更好得方法?

^_^

5.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: floater
Posted on: 2003-06-19 13:19

only way because it's inside "".

6.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: supermy
Posted on: 2003-06-20 09:16

jstl 输出变量 <c:out value="${变量}"/> 定义变量<c:set var="aaa">变量值</c:set>

7.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: fhk1999
Posted on: 2003-07-01 13:29

Why not evaluate the logic in action and put result in request object?

8.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: 老刀
Posted on: 2003-07-05 12:09

hehe, I won't seperate the bean into several sub-beans.

9.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: liuhey
Posted on: 2003-07-24 14:58

我觉得是不是可以这么做:

<bean:define id="center" name="componentForm" property="centerID"/>
<logic:equal name="pageForm" property="centerID" value="<%=center%>">
.....
</logic:equal>

10.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: coala
Posted on: 2003-07-24 15:27

value

The constant value to which the variable, specified by other attribute(s) of this tag, will be compared.

(REQUIRED) (RT EXPR)

肯定可以用表达式。

(RT EXPR)就代表了这个是可以用表达式的。

多去查查strtus的英文文档,那里的资料最权威。

11.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: robin
Posted on: 2003-07-24 15:34

我的意见是model 2x比较tag来说要简单的多也灵活的多!

12.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: supermy
Posted on: 2003-08-16 16:40

在action中对frombean进行初始化

13.Re:在struts里怎么写Value [Re: 老刀] Copy to clipboard
Posted by: 老刀
Posted on: 2003-08-17 16:32

其实我是要实现一个数据的分组功能,可以很多的方法做,在SERVER SIDE可以将数据挖掘功能做得很好,但我这个数据挖掘深度很小,故直接在页面内实现一个简单的分组功能。
后来我又试过其它的方法,但这个最简单,性能好像也是最好的。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923