Replacing/n with jstl with N Solutions

Source: Internet
Author: User

To work, you must use jstl to replace/N in multiple lines of text extracted from the database with <br/>.

1. Put the extracted multi-line text in the <PRE> </PRE> label

Advantage: simple. html is used to solve the problem.

Disadvantage: Pre does not seem to recognize the CSS style. This label is "unchanged" and CSS does not recognize it. This disadvantage is fatal.

Ii. jstl-only mode <C: Out value = "$ {fn: Replace (content, '/N',' <br/> ')}"/>

Multiple n errors will be thrown during a single operation.

3. jstl + JSP scriptlet

<%
Request. setattribute ("x_n", "/N ");
%>

<C: Out value = "$ {fn: Replace (content, X_n, '<br/>')}"/>

Advantages: easy to understand and easy to modify

Disadvantage: JSP scriptlet is referenced.ProgramMembers are intolerable;CodeMany.

4. jstl + JavaBean

There is no new idea, but the scriptlet is gone, but the class file needs to be modified.

5. Use listeners

Advantage: when the application is initialized,/N is used as an attribute in the application scope, with less code and resource saving.

Disadvantage: XML needs to be configured, which must be modified in the class during modification.

6. Use custom tags

Customize a db2html tag, <C: Out value = "$ {fnx: db2html (content)}"/>

Advantages: easy to use,

Disadvantage: There are many configurations. Trouble.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.