Storing TextArea data with line breaks in database and displaying in same format with line breaks

后端 未结 1 1924
感情败类
感情败类 2021-01-25 11:28

I have a JSP page with a textarea HTML component. When a user presses enter and goes to next line while typing in textarea,and when he clicks save button, it saves the data from

1条回答
  •  南方客
    南方客 (楼主)
    2021-01-25 11:57

    The replaceAll method return a new String. Your variable a is never modified.

    To solve your problem : a = a.replaceAll("\n","
    ");

    In this kind of method, reading the javadoc is time saver.

    Regards.

    0 讨论(0)
提交回复
热议问题