-2
<% String b="a\na"; %>
<%=b%>

When the above code is printed, it is displayed as'a a'.

How do you represent line breaks?

psj
  • 37
  • 1
  • 8
  • does this answer your question[How to put “new line” in JSP's Expression Language](https://stackoverflow.com/questions/1908365/how-to-put-new-line-in-jsps-expression-language)? – XO56 Feb 04 '21 at 16:04
  • JSP creates HTML. Linebreaks in HTML are usually ignored unless they are in a special tag like `
    ` and can be created with the tag `
    `. You might want to look up a basic HTML tutorial and look up how HTML is used to format elements before starting to work with JSP.
    – OH GOD SPIDERS Feb 04 '21 at 16:04
  • @XO56 If you hit the "Flag" button under the question and select it to be a duplicate of that question, it will automatically insert that comment for you. (Like mine above.) And it also pushes this question into a review queue where people can vote to close it as an duplicate. – Ivar Feb 04 '21 at 16:07
  • 1
    @Ivar Thank you very much :) – XO56 Feb 04 '21 at 16:09

1 Answers1

2

To enter a linebreak in JSP you need to use <br/> instead of \n for it to show in the browser.