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.

1
  • 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. Commented Apr 8, 2013 at 13:12

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

1 Comment

pre causes additional line breaks :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.