<select name="communit">
<option value="万里江山"<c:if test="${万里江山==entry.communit}"> selected</c:if>>万里江山</option>
<option value="我是中文"<c:if test="${我是中文==entry.communit}"> selected</c:if>>我是中文</option>
</select>提示错误:org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for fmt</h3><p>null: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the CDATA section.</p><h3>Validation error messages from TagLibraryValidator for c</h3><p>null: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was found in the CDATA section.</p><select name="communit">
<option value="1"<c:if test="${1==entry.communit}"> selected</c:if>>万里江山</option>
<option value="2"<c:if test="${2==entry.communit}"> selected</c:if>>我是中文</option>
</select>
则没有问题。数字对比或者英文对比都没问题。但用中文,则出错。请问怎么办?

解决方案 »

  1.   

    <option value="万里江山" <c:if test="万里江山==entry.communit"> selected</c:if> >万里江山</option>
      

  2.   

    <c:if test="${'万里江山'==entry.communit}"> selected</c:if>单独使用没问题。
    一旦跟<option 结合则出问题<option value="万里江山" <c:if test="${'万里江山'==entry.communit}"> selected</c:if>>万里江山</option>
      

  3.   

    ${entry.communit == '万里江山' ? 'selected' : ''}
    单独使用没问题。一旦跟<option结合,就没有显示。
      

  4.   

    <c:if test="万里江山==entry.communit"> 
    <option value="万里江山"selected >万里江山</option> 
    </c:if>
     
      

  5.   


    <select name="communit">
    <option value="万里江山" ${entry.communit==‘万里江山’?'selected',''}>万里江山</option>
    <option value="我是中文" ${entry.communit==‘我是中文’?'selected',''}>我是中文</option>
    </select> 这样试一试  我一般是这么做的  
      

  6.   

    这样写:
    <select name="communit">
    <option value="万里江山"<c:if test="${‘万里江山’==entry.communit}"> selected</c:if>>万里江山</option>
    <option value="我是中文"<c:if test="${‘我是中文’==entry.communit}"> selected</c:if>>我是中文</option>
    </select>