我是拷出去看了半天才看明白你要干什么。呵呵,你换这种写法试试
   <select name="classid">
<logic:iterate name="ServiceClass" id="serc">
<logic:equal name="serc" property="sckeyid" value="<bean:write name=list property=classid/>">
         <option selected="selected" value="<bean:write name="serc" property="sckeyid"/>">
             <bean:write name="serc" property="classname"/>
         </option>
          </logic:equal>
<logic:notEqual name="serc" property="sckeyid" value="<bean:write name=list property=classid/>">
         <option value="<bean:write name="serc" property="sckeyid"/>">
             <bean:write name="serc" property="classname"/>
         </option>
          </logic:notEqual> </logic:iterate>
</select>

解决方案 »

  1.   

    非常感谢,结果还是一样,好像并没有取到<bean:write name=list property=classid/>值。我的完整结构如下:
    <logic:present name="HistoryList">
    <logic:notEmpty name="HistoryList">
    <logic:iterate name="HistoryList" id="list">
      <tr>
        <td>记 录 人</td>
        <td colspan="2"><bean:write name="list" property="registrar"/></td>
        <td>号码</td>
        <td><bean:write name="list" property="telid"/></td>
      </tr>
      <tr>
        <td>内容分类<bean:write name="list" property="classid"/></td>
        <td>
        <select name="classid">
    <logic:iterate name="ServiceClass" id="serc">
    <option value="<bean:write name="serc" property="sckeyid"/>" <logic:equal name="serc" property="sckeyid" value="<bean:write name=list property=classid/>">selected</logic:equal>><bean:write name="serc" property="classname"/></option>
    </logic:iterate>
    </select>
    </td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
    </logic:iterate>
    </logic:notEmpty>
    </logic:present>
      

  2.   

    如果我直接将<bean:write name=list property=classid/>改为某个类型的ID值,则就可以。所以现在的问题就是如果将这个bean的值引用到serc的bean中,谢谢。
      

  3.   

    那我建议你用JSTL的标签吧。这个问题我好像也碰到过。<bean:write>放到<option>的value里会报错,我经常用<c:out value="${}"/>来解决!
      

  4.   

    实在不行就<%=list.getClassid()%>,Struts的标签毛病太多了
      

  5.   

    需要先创建一个list对象后才能使用<%=list.getClassid()%>,是吗?
    我刚用JAVA,不太熟,非常感谢。
      

  6.   

    不用,直接可以用的,如果开发工具提示错误,你不要理他,可以直接使用的。他是放在<logic:iterate>中的,直接用<%=list.getClassid()%>就可以。你写了试试!
      

  7.   

    <bean:write>放到<option>中没有问题,就是放到<logic:equal>的value中,不知如何处理
      

  8.   

    与上边一样,你用<%=list.getClassid()%>把<bean:write name=list property=classid/>替换掉!
      

  9.   

    我试了,编译就不通过。org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 97 in the jsp file: /manPower/TelHistoryEdit.jsp
    Generated servlet error:
    D:\jakarta-tomcat-5.0.28\work\Catalina\localhost\_\org\apache\jsp\manPower\TelHistoryEdit_jsp.java:239: cannot resolve symbol
    symbol  : method getClassid ()
    location: class java.lang.Object
                          _jspx_th_logic_equal_0.setValue(list.getClassid());
                                                              ^
    1 error
      

  10.   

    你的classid是整型吧,你改成这样试试<%=String.valueOf(list.getClassid())%>,就是把他转成String型
      

  11.   

    org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 97 in the jsp file: /manPower/TelHistoryEdit.jsp
    Generated servlet error:
    D:\jakarta-tomcat-5.0.28\work\Catalina\localhost\_\org\apache\jsp\manPower\TelHistoryEdit_jsp.java:239: cannot resolve symbol
    symbol  : method getClassid ()
    location: class java.lang.Object
                          _jspx_th_logic_equal_0.setValue(String.valueOf(list.getClassid()));
                                                                             ^
    1 error
      

  12.   

    刚才那个错误小箭头是指在getClassid下面的,可能是网页中显示空格的问题。
      

  13.   

    太感谢您了!<%@ page contentType="text/html; charset=gb2312" %>
    <%@ taglib uri="/tlds/struts-html" prefix="html" %>
    <%@ taglib uri="/tlds/struts-bean" prefix="bean" %>
    <%@ taglib uri="/tlds/struts-logic" prefix="logic" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <Meta http-equiv="Pragma" Content="No-cach">
    <LINK href="/css/Style.css" type=text/css rel=stylesheet>
    <script language="javascript" src="/js/Calendar.js"></script>
    <script language="javascript" src="/js/common.js"></script>
    </HEAD>
    <BODY><table border="0" cellpadding="2" cellspacing="2">
    <form name=form1 action="tempTelAndService.do?method=telHistoryInfoEdit">
    <logic:present name="HistoryList">
    <logic:notEmpty name="HistoryList">
    <logic:iterate name="HistoryList" id="list">
      <tr>
        <td>记 录 人</td>
        <td colspan="2"><bean:write name="list" property="registrar"/></td>
        <td>主叫号码</td>
        <td><bean:write name="list" property="telid"/></td>
      </tr>
      <tr>
        <td>内容分类<bean:write name="list" property="classid"/></td>
        <td>
        <select name="classid">
    <logic:iterate name="ServiceClass" id="serc">
    <option value="<bean:write name="serc" property="sckeyid"/>" <logic:equal name="serc" property="sckeyid" value="<%=String.valueOf(list.getClassid())%>">selected</logic:equal>><bean:write name="serc" property="classname"/></option>
    </logic:iterate>
    </select>
    </td>
        <td></td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td>通话方式<bean:write name="list" property="callwisename"/></td>
        <td><input name="wise" id="wiseone" onClick="clickwiseone();" type="radio" <logic:equal name="list" property="callwise" value="0">checked</logic:equal> value="0"><label for="wiseone" onClick="clickwiseone();">直接</label></td>
        <td><input name="wise" id="wisetwo" onClick="clickwisetwo();" type="radio" <logic:equal name="list" property="callwise" value="1">checked</logic:equal> value="1"><label for="wisetwo" onClick="clickwisetwo();">转接</label></td>
        <td><input name="wise" id="wiseth" onClick="clickwiseth();" type="radio" <logic:equal name="list" property="callwise" value="2">checked</logic:equal> value="2"><label for="wiseth" onClick="clickwiseth();">语音服务</label></td>
        <td><input name="wise" id="wisefo" onClick="clickwisefo();" type="radio" <logic:equal name="list" property="callwise" value="3">checked</logic:equal> value="3"><label for="wisefo" onClick="clickwisefo();">多方</label></td>
      </tr>
      <tr>
        <td>通话意图<bean:write name="list" property="callintentname"/></td>
        <td><input name="intent" id="intentone" onClick="clickintentone();" type="radio" <logic:equal name="list" property="callintent" value="0">checked</logic:equal> value="0"><label for="intentone" onClick="clickintentone();">咨询</label></td>
        <td><input name="intent" id="intenttwo" onClick="clickintenttwo();" type="radio" <logic:equal name="list" property="callintent" value="1">checked</logic:equal> value="1"><label for="intenttwo" onClick="clickintenttwo();">投诉</label></td>
        <td><input name="intent" id="intentth" onClick="clickintentth();" type="radio" <logic:equal name="list" property="callintent" value="2">checked</logic:equal> value="2"><label for="intentth" onClick="clickintentth();">其它</label></td>
        <td><input name="intent" id="intentfo" onClick="clickintentfo();" type="radio" <logic:equal name="list" property="callintent" value="3">checked</logic:equal> value="3"><label for="intentfo" onClick="clickintentfo();">非HR</label></td>
      </tr>
      <tr>
        <td>通话结果<bean:write name="list" property="callresultname"/></td>
        <td><input name="result" id="resultone" onClick="clickresultone();" type="radio" <logic:equal name="list" property="callresult" value="0">checked</logic:equal> value="0"><label for="resultone" onClick="clickresultone();">完成</label></td>
        <td><input name="result" id="resulttwo" onClick="clickresulttwo();" type="radio" <logic:equal name="list" property="callresult" value="1">checked</logic:equal> value="1"><label for="resulttwo" onClick="clickresulttwo();">限时回复</label></td>
        <td><input name="result" id="resultth" onClick="clickresultth();" type="radio" <logic:equal name="list" property="callresult" value="2">checked</logic:equal> value="2"><label for="resultth" onClick="clickresultth();">待确认</label></td>
        <td><input name="result" id="resultfo" onClick="clickresultfo();" type="radio" <logic:equal name="list" property="callresult" value="3">checked</logic:equal> value="3"><label for="resultfo" onClick="clickresultfo();">转交他人</label></td>
      </tr>
      <tr>
        <td>通话时间</td>
        <td colspan="4"><bean:write name="list" property="begintime"/> 到 <bean:write name="list" property="endtime"/></td>
      </tr>
      <tr>
        <td>沟通评价<bean:write name="list" property="communicatename"/></td>
        <td colspan="4"><select name="communicateappraise" title="沟通评价 ~!">
            <option value="" selected>请选择!</option>
            <option <logic:equal name="list" property="communicateappraise" value="0">selected</logic:equal> value="0">好</option>
            <option <logic:equal name="list" property="communicateappraise" value="1">selected</logic:equal> value="1">中</option>
            <option <logic:equal name="list" property="communicateappraise" value="2">selected</logic:equal> value="2">差</option>
        </select></td>
      </tr>
      <tr>
        <td>通话内容</td>
        <td colspan="4"><textarea cols="60" rows="8"><bean:write name="list" property="contentpart"/></textarea></td>
      </tr>
      <tr>
        <td colspan="5" align="center" height="30"><a href="tempTelAndService.do?method=showHistoryIfo&tel=<bean:write name="list" property="telid"/>""><img src="/images/common/return.gif" align="absmiddle" class="handstyle"></a>&nbsp;&nbsp;
      <img src="/images/common/submit.gif" align="absmiddle" onClick="form1.submit();" class="handstyle"></td>
      </tr>
    </logic:iterate>
    </logic:notEmpty>
    </logic:present>
    </form>
    </table>
      

  14.   

    是不是如果把<logic:equal> 里的value换成一个具体的值,编辑就没有问题?
    如果是的话
    你在<logic:iterate name="HistoryList" id="list">这里把list对象的type加上试试就是这个对象的类路径
      

  15.   

    是包的路径吗?
    com.ssd.system.manPower
    JAVA为
    com.ssd.system.manPower.tempAction.java是上一个还是下一个,谢谢。
      

  16.   

    HistoryList你的这个list里面方的是com.ssd.system.manPower.tempAction这个对象吗?如果是就是com.ssd.system.manPower.tempAction
      

  17.   

    <logic:iterate id="emp" name="empList" scope="request" type="com.xxxx.xxxx.Employee">
    这是个例子,我的empList里放的是若干个Employee对象
      

  18.   

    D:\jakarta-tomcat-5.0.28\work\Catalina\localhost\_\org\apache\jsp\manPower\TelHistoryEdit_jsp.java:209: cannot resolve symbol
    symbol  : method getClassid ()
    location: class com.ssd.system.manPower.tempAction
                          _jspx_th_logic_equal_0.setValue(String.valueOf(list.getClassid()));
      

  19.   

    在<logic:iterate name="HistoryList" id="list">中加上type后,反而有问题,编译通过,但JSP运行有问题
      

  20.   

    你的list就是tempAction这个类的一个实例吗?我总觉的不是吧,那是一个Action啊
      

  21.   

    可以了,非常感谢, type后是TempAction,我没有注意大小写。太感谢您了。