Question

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.

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top