Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Carriage return and html

Carriage return and html

2004-01-16       - By Vidar Langberget

 Back
Reply:     1     2  

I know how to parse carriage returns and replace it with <br>, but I need a
bit more advanced logic. The problem is that the text I need to parse
contains both carriage returns and some basic html. For example headings use
<h2>Heading</h2> and there are a few html tables as well. The tables are the
biggest problem. The replace method I've written puts <br> several places
inside the table html code, so it looks horrible in a browser. This is a
small example:

<table cellpadding="2" align="Center"><br/> <tbody><br/> <tr
valign="Top"><br/> <td valign="Top"><br/> <div align="Left"> <h6>
Architecture:</h6><br/> </div><br/> </td><br/> <td valign="Top"><h6>
K7</h6><br/> </td><br/> <td valign="Top"><h6> P6</h6><br/> </td><br/>
</tr><br/> <tr valign="Top"><br/> <td valign="Top"><p><b> Cache block
size:</b></p><br/> </td><br/> <td valign="Top"><p> 64 Bytes<br/> </td><br/>
<td valign="Top"><p> 32 Bytes<br/> </td><br/> </tr><br>

As you can imagine I need to improve my parsing method to skip adding <br>
inside <table and </table>.

Any idea how I can do this?

Also, the heading is a problem. The whole text is put inside <p></p> and it
works as long as there is no html in the text. But after a heading using
<h2> for example, the rest of the text is rendered using standard text as
defined in the browser, and not as <p> is defined in my stylesheet. What I
need to do is add a <p> tag to the text after a blank line UNLESS the next
line is a heading. Suggestions on how to handle this?

Any help appreciated!

Vidar

===========================================================================
To unsubscribe: mailto listserv@(protected) with body: "signoff JSP-INTEREST".
For digest: mailto listserv@(protected) with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com



©2008 junlu.com - Jax Systems, LLC, U.S.A.