Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with decoding < >

lpopek February 11, 2019

Problem with decoding

<
>

I have method in Java that generate html code for example

<strong>ID</strong>

I use velocity to get variables and in my HTML i get output <strong>ID<strong> . Text is not strong, but I have result with tags. How to resolve this?

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2019

Strings in java see / as an escape character, so the plain text you are generating is escaping instead of outputting the /

Off the top of my head, I can't remember how to fix it, but vaguely remember you have to do something like

outputString = "<strong>ID<//strong>"

lpopek February 11, 2019

I tried this also, doesnt work. Thanks for respond 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2019

Sorry, my java "escaping slashes" memory is very old

lpopek February 11, 2019

I tried 
outputString = "\\<strong\\>ID\\<strong\\>"

dont work. 

Also i try 

$esc.html

 still dont work, Im so disappointed 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events