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中,但是,并没有成功。而且上面?中的内容也不知道该如何写。
请大家指教。
也就是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中,但是,并没有成功。而且上面?中的内容也不知道该如何写。
请大家指教。
另外,刚才考虑到一种方法就是在db中的字符串取得以后,用该行符号连接成string。
然后直接表示就可以不用循环iterate了。
该行符号用什么表示呢?我用<BR>不管用,直接输出<BR>了,并没有改行。
本来想显示为welcome,另外一行为to our home.
结果显示的时候是welcome\n to our home.。
并没有换行
<logic:iterate id="mailbean" name="mailInfo.mailTextList" length="" indexId="index">
<bean:write name="mailbean" property="mailText" />
</logic:iterate>
</html:textarea>
就是你想把这些内容保存到哪
<logic:iterate id="mailbean" name="mailInfo.mailTextList" length="" indexId="index">
<bean:write name="mailbean" property="mailText" /><%="\n" %>
</logic:iterate>
</html:textarea>
这样应该可以
关于?,不知道如何写好。
写成下面的样子,就不能实现循环
<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对应两个变量。肯定不对。
如何既能实现循环,又能正常取得数据呢?
不太好说明,不知道大家能不能明白。
<%= "aaa /n aaa"%>
不是
<%="aaa"%><%="/n"%><%="aaa"%>
明白么?