开发者

<logic:iterate question

开发者 https://www.devze.com 2023-02-10 15:13 出处:网络
I need to pull all teh messages from a table and display on the jsp page. I have the code like below:

I need to pull all teh messages from a table and display on the jsp page. I have the code like below: I have the list of messages stored as : SimpleStringVO string value: Welcome to the XYZ Tool homepage. ,SimpleStringVO string value: Here you can enter your account number ,SimpleStringVO string value: ,SimpleStringVO string value: thank you

When I tried to开发者_Go百科 display this in jsp page, the message is not formated as it is stored. "thank you" comes immediately after the 2nd string. I need to display the space string and then the "thank you" string. (3rd string has just spaces) My code in Jsp is like this :

  <td><logic:iterate name="AllNewsCashe" id="news" type="com.fw.valueobject.SimpleStringVO"> 
          <bean:write name="news" property="stringValue"/> 
          </logic:iterate> 
        </td>        

how to display thise messages as it is without formating ?


If you need to force a space in HTML, you will need to store it as &nbsp; instead of " ". However, since are you using bean:write tag, you can probably use filter property to retain " ":-

<bean:write name="news" property="stringValue" filter="false" /> 

Here's the description of filter from Struts documentation:-

If this attribute is set to true, the rendered property value will be filtered for characters that are sensitive in HTML, and any such characters will be replaced by their entity equivalents.

0

精彩评论

暂无评论...
验证码 换一张
取 消