[Javascript] XMP tag related problem

sunita desai sudesai at cisco.com
Wed Aug 7 00:14:15 CDT 2002


Hi,

Actually I have this particular problem with the Web based Application that
is being developed.
Your answers, and any pointers will be very helpful.

In one particular JSP, a socket connection is being established at the
backend, and data is continously
pushed from there, and the need is to read the Strings line by line and
display/dump on the
browser screen. If the String is enclosed between XMP tag

<XMP>%=data%</XMP> where data has the one text line content read from the
Socket output stream.

the formatings information coming from the backend (the white space, tabs
etc) are retained and display
is proper, but the problem is an extra line is inserted by the <XMP> tag
which is not required by the customer.

But if we don't use the <XMP> tag and just use %=data% the formatting info
is lost, because the HTML
does not interpret the tabs, spaces etc, and even if some HTML specific tags
are part of the text coming
from backend, it will not be displayed as it is. Even I have tried using
<div> and <PRE> tags, but the formatting info is lost.

So the question is there any other way to dump pure text on browser without
loosing the formatting information?

DOes using an applet for real time display purposes would be a better way?

Thanks in advance,
Regards,
Sunita

The code snippet without XMP tag:

String data="";
while ((str = rd.readLine()) != null) {
                    data = data + str + "<BR>";
                    //increment the total lines counter by one
                    count = count + 1;
	                 <%=data%>

                        //flush the out buffer
                        out.flush()
                        // re-initialise the data string
                        data="";



Display without <XMP> tag:

----------------------
MGCP MESSAGES DISPLAY
----------------------

Time stamp Orig IP address Dest IP address Prot Msg Data
----------------------------------------------------------------------------
---------------------------
First packet received - 08/06/2002

20:37:51.607341 10.10.99.106:2427 10.10.99.41:2427 MGCP...... -> 200 4100052
OK

v=0
c=IN IP4 10.10.99.106
m=audio 49288 RTP/AVP 0
20:37:53.384690 10.10.99.41:2427 10.10.99.106:2427 MGCP...... -> CRCX
4100054 vism/t1-6/21 at mgxc101-13 MGCP 0.1
C: A6DF1
L: e:off
M: inactive
R:
X: D67D
S:




The code snippet with XMP tag:

String data="";
while ((str = rd.readLine()) != null) {
                    data = data + str;
                    //increment the total lines counter by one
                    count = count + 1;
	                 <XMP><%=data%></XMP>

                        //flush the out buffer
                        out.flush()
                        // re-initialise the data string
                        data="";



Display with XMP tag:

----------------------

 MGCP MESSAGES DISPLAY

 ----------------------


Time stamp       Orig IP address      Dest IP address      Prot          Msg
Data

----------------------------------------------------------------------------
---------------------------

First packet received - 08/06/2002



20:44:03.193352  10.10.99.41:2427     10.10.99.106:2427    MGCP...... ->
CRCX 4100098 vism/t1-6/16 at mgxc101-13 MGCP 0.1

                                                                         C:
A6DF9

                                                                         L:
e:off

                                                                         M:
inactive

                                                                         R:

                                                                         X:
D68D

                                                                         S:

View source gives this:
         <XMP> ---------------------- </XMP>


         <XMP> MGCP MESSAGES DISPLAY  </XMP>


         <XMP> ---------------------- </XMP>


         <XMP> </XMP>


         <XMP>Time stamp       Orig IP address      Dest IP address
Prot          Msg  Data </XMP>



<XMP>-----------------------------------------------------------------------
-------------------------------- </XMP>


         <XMP>First packet received - 08/06/2002</XMP>


         <XMP></XMP>


         <XMP>20:50:39.575409  10.10.99.41:2427     10.10.99.190:2427
MGCP...... -> CRCX 4100079 vism/t1-8/8 at mgxc201-10 MGCP 0.1</XMP>


         <XMP>
C: A6DF5</XMP>




More information about the Javascript mailing list