How to display <br> from a string to html

Posted on 2004-12-01
Last Modified: 2010-03-31
I have bean class

public class X ......{
String htmlString;
public void getHtmlString()
return htmlString;
public void setHtmlString()
String htmlString_="Hello<br>Hello";
this.htmlString = htmlString_;

From the Jsp page I use
<bean:write name="X" property="htmlString"/>

The output of the jsp displays Hello <br> Hello.

Instead i need a output like

If i use <%= <brString> %> it works fine. It display

Instead if i use <bean:write> then it does not display in next line.

Question by:srivenky
    LVL 14

    Accepted Solution

    LVL 3

    Expert Comment

    Actually, this is by design.  bean:write escapes all HTML by default so that strings come out as they look, not as HTML tags.

    Try adding filter="false" to turn off escaping.

    <bean:write name="X" property="htmlString" filter="false"/>

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    Return ZipOutputStream using Servlet 2 26
    endX challenge 2 30
    count11 challenge 6 30
    What is the latest versions eclipse neon 2 55
    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now