arsenal
arsenal

Reputation: 24154

Print a new line in JSTL

How can I add a new line in my JSTL. I tried using <br/>,its not working for me. I have added JSTL tag in my JSP page.

<fieldset>
      <legend>Performance Testing:</legend>
        <c:forEach items="${histogram}" var="entry">
          Key = ${entry.key}, Value = ${entry.value}<br/>
         </c:forEach>

</fieldset>

Currently it is getting printed like this

Key = 83, Value = 1 Key = 37, Value = 25 

I need something like this-

Key = 83, Value = 1
Key = 37, Value = 25

Updated:-

I tried debugging using Firebug and I found out this source code got generated-

<fieldset>
<legend>Performance Testing:</legend>
Key = 38, Value = 2
<br>
Key = 39, Value = 3
<br>
Key = 40, Value = 1
<br>
Key = 88, Value = 1
<br>
Key = 41, Value = 1
<br>
Key = 42, Value = 2
<br>
</fieldset>

And this also has line break, But still it get shows in a single line like in the below screenshot- Not how I wanted line by line as I mentioned above.

enter image description here

CSS that I have currently-

fieldset {
    margin: 0 0 22px 0;
    border: 1px solid #095D92;
    padding: 12px 17px;
    background-color: #DFF3FF;
}

legend {
    font-size: 1.1em;
    background-color: #095D92;
    color: #FFFFFF;
    font-weight: bold;
    padding: 4px 8px;
}

Upvotes: 2

Views: 1698

Answers (1)

adarshr
adarshr

Reputation: 62593

There is no way that cannot work unless the change never got deployed! Try clearing the server cache. If using tomcat, clear the tmp and work directories.

If the JSP is being included in another JSP, try touching both the JSPs and then have a look.

Also, I am not sure if HTML allows you to have line breaks within <fieldset/> tag. I maybe completely wrong on this one, but just to be sure put this piece of code in a regular <div/> tag and try.

Upvotes: 3

Related Questions