javac
javac

Reputation: 25

Display String array with struts 2 in jsp

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.

Upvotes: 0

Views: 1985

Answers (1)

Bhushan Bhangale
Bhushan Bhangale

Reputation: 10987

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>

Upvotes: 2

Related Questions