RSS
热门关键字:  数据挖掘  人工智能  数据仓库  搜索引擎  数据挖掘导论

处理完HTML里面回车符 的问题

来源: 作者:unkonwn 时间:2005-12-18 点击:

目的:按用户的“本来面目”显示录入的数据 --有回车的话显示处理就得换行。。。。

操作数据库代码里:
  String text = text1.replaceAll(" ","<br>").trim();
  boardItem.setText(text);

在detail页面上:<bean:write name = "BoardItemForm" property="text" filter="flase"/> 
                                                                                                                                ~~~~~关键 数据挖掘研究院

但是在edit页面遇到了问题:
这样行不通:(回车的地方都显示成了<br>)
   <html:textarea property="text" cols="50" rows="10" value="<bean:write name = "BoardItemForm" property="text" filter="flase"/>">
   </html:textarea>

找了不少资料,其中有一个人提到:
In Ted"s answer above, it is given: value="<bean:write name="employeeBean" property="name"/>" value should be enclosed in single quotes and not double quotes. value="<bean:write name="employeeBean" property="name"/>" It will work. Courtesy: Ted"s own Struts book.
http://www.jguru.com/faq/view.jsp?EID=1023589

Failed too!

So i chose define tag,but it doesn"t have filter value

For about half of hour"s thinking,at last I chose:

 <!--replace <br> with -->
 <bean:define id="text" name="BoardItemForm" property="text" type="String"/>
 <%

数据挖掘研究院


  String realText = text.replaceAll("<br>"," ");
 %>
 <bean:message key="common.text"/>:
   <html:textarea property="text" cols="50" rows="10" value="<%=realText%>">
   </html:textarea>


ok,done although not so perfect!

It"s time to go to bed!

Good night!
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
匿名?