struts中,db中有一个关于mail信息的表。主要是行号,和内容。
也就是mail的内容是第一行的话,就取得第一行的内容,显示在画面textarea中。
<html:textarea property="?" rows="15" cols="65">
    <logic:iterate id="mailbean" name="mailInfo.mailTextList" length="" indexId="index">
     <bean:write name="mailbean" property="mailText" /><br>
    </logic:iterate>
    </html:textarea>
如上面所写,大致意思就是循环把mailInfo.mailTextList里面的内容,通过改行输出到textarea中,但是,并没有成功。而且上面?中的内容也不知道该如何写。
请大家指教。

解决方案 »

  1.   

    property="?" 
    另外,刚才考虑到一种方法就是在db中的字符串取得以后,用该行符号连接成string。
    然后直接表示就可以不用循环iterate了。
    该行符号用什么表示呢?我用<BR>不管用,直接输出<BR>了,并没有改行。
      

  2.   

    如果db中变成welcome\n to our home.
    本来想显示为welcome,另外一行为to our home.
    结果显示的时候是welcome\n to our home.。
    并没有换行
      

  3.   

    <html:textarea property="?" rows="15" cols="65">
        <logic:iterate id="mailbean" name="mailInfo.mailTextList" length="" indexId="index">
         <bean:write name="mailbean" property="mailText" />&#13;&#10;
        </logic:iterate>
        </html:textarea>
      

  4.   

    property="?"        ?是form中的一个变量,可能数据库中的一个字段吧
    就是你想把这些内容保存到哪
      

  5.   

    <html:textarea property="?" rows="15" cols="65">
        <logic:iterate id="mailbean" name="mailInfo.mailTextList" length="" indexId="index">
         <bean:write name="mailbean" property="mailText" /><%="\n" %>
        </logic:iterate>
        </html:textarea>
    这样应该可以
      

  6.   

    谢谢大家。
    关于?,不知道如何写好。
    写成下面的样子,就不能实现循环
    <html:textarea property="mailTextList" name="mailInfo" rows="15" cols="65">
    </html:textarea>而写成
    <html:textarea property="mailInfo.test1" rows="15" cols="65">
        <logic:iterate id="mailbean" name="mailInfo.mailTextList" length="" indexId="index">
         <bean:write name="mailbean" property="mailText" /><%="\n" %>
        </logic:iterate>
        </html:textarea>
    就更不对了,同一个textarea对应两个变量。肯定不对。
    如何既能实现循环,又能正常取得数据呢?
    不太好说明,不知道大家能不能明白。
      

  7.   

    不是在取出数据的时候使用 \n ,是在你串字符串的时候用上的.
    <%= "aaa /n aaa"%>
    不是
    <%="aaa"%><%="/n"%><%="aaa"%>
    明白么?