0

I want to display string array on jsp. below is the code I have written :

<s:iterator value="ccActivityOperationVO.output" var="Output">
    <s:property value="#Output"/><br/>
</s:iterator>

With this code i am able to print string array, but I am losing formatting like spaces before and after text is no more. Note: I have not used any kind of trimming.

Bhushan Bhangale
  • 10,921
  • 5
  • 43
  • 71
javac
  • 25
  • 10
  • The white space before and after the value is probably there, just not shown by the browser. Check the page source (in your browser) to confirm this. – Martin Wilson Apr 08 '13 at 13:12

1 Answers1

2

Wrap the <pre> tag around the value. It preserves white space.

<s:iterator value="ccActivityOperationVO.output" var="Output">
    <pre><s:property value="#Output"/></pre><br/>
</s:iterator>

Add following style in the HTML head

<style type='text/css'> pre {display: inline;} </style>
Bhushan Bhangale
  • 10,921
  • 5
  • 43
  • 71