Escape apostrophe as \' with c:out JSP

前端 未结 2 1863
忘掉有多难
忘掉有多难 2021-01-20 10:25

I have an object field with person\'s last name.

If I use ${person.lastName}, I get O\'Brian

If I use

 

        
2条回答
  •  日久生厌
    2021-01-20 10:59

    Store it as O'brian in the database, but before displaying it do a find replace to convert any ' to \'

提交回复
热议问题