你要显示的是cl中的id吗?看你的意思是一个name。
譬如如果是id相同,显示一个名字的话,
<bean:write name="cl" property="name"/>
看看是否可以?

解决方案 »

  1.   

    需要先判断beanname中的id是否和cl中的id相同,如果相等才显示cl.name
      

  2.   


    <logic:equal name="beanname" property="id" value="???????">把value="????"的双引号,换成    单     引号就好了!
      

  3.   

    <logic:iterate id="cl" name="Ids"> //循环取得id
    <bean:define id="temId" name="cl" property="id" type="java.lang.String"/>
      <logic:equal name="beanname" property="id" value="<%=temId%>"> //比较beanname中的id是否和cl中的id相同,如果相同就显示cl中的name
        <bean:write name="cl" property="name"/>
      </logic:equal>
    </logic:iterate> 
      

  4.   

    我把value="????"的双引号换成单引号了,没有报错,但是取不到cl.id的值了。就是这句
    <bean:write name="cl" property="id"/>,单独使用这句标签可以正常显示。
      

  5.   

    <logic:iterate id="cl" name="Ids"> //循环取得id
    <bean:define id="temId" name="cl" property="id" type="java.lang.String"/>
      <logic:equal name="beanname" property="id" value="<%=temId%>"> //比较beanname中的id是否和cl中的id相同,如果相同就显示cl中的name
        <bean:write name="cl" property="name"/>
      </logic:equal>
    </logic:iterate> 先定义后使用,肯定是这样!!!我做了3个struts的项目都是这么写的,没见过其他的方法能实现。
      

  6.   

    <bean:define id="temId" name="cl" property="id" type="java.lang.String"/>
    怎么为null啊?我bean:write这个值都可以出来。id是一个int类型的,type="java.lang.String"改成了type="int",就报错误。
      

  7.   

    int是标准数据类型,Integer才是类
      

  8.   

    改成type="java.lang.Integer"后,出现下面的错误了[ServletException in:/customer/update.jsp] Unable to compile class for JSP An error occurred at line: 48 in the jsp file: /customer/update.jsp Generated servlet error: [javac] Compiling 1 source file E:\Tomcat 4.1\work\Standalone\localhost\customer\update_jsp.java:188: cannot resolve symbol symbol : method setValue (java.lang.Integer) location: class org.apache.struts.taglib.logic.EqualTag _jspx_th_logic_equal_7.setValue(tempId); ^ 1 error '
      

  9.   

    <logic:equal name="beanname" property="id" value="<%=String.valueOf(temId)%>">再试试看。其实还是用String型的方便。
      

  10.   

    好方法,向我们的kadina(次帅)兄学习