Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

A question

Posted on 2006-06-13
4
380 Views
Last Modified: 2010-04-01
I have a WYSIWYG editor . I have saved informations that they wrote in editor . When I saw in database , it saved like that

<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>You can login to http://www.escentual.co.uk with this email address </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>and password combination.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>B&#7841;n có th&#7875; &#273;&#259;ng nh&#7853;p vào trang </FONT><A href="http://www.escentual.co.uk/"><FONT face="Times New Roman" size=3>http://www.escentual.co.uk</FONT></A><FONT face="Times New Roman" size=3> v&#7899;i &#273;&#7883;a ch&#7881; h&#7897;p th&#432; và m&#7853;t kh&#7849;u &#273;&#259;ng nh&#7853;p này </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>When you log in we advise that you change your password to </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>something more memorable to yourself.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Sau khi &#273;ã &#273;&#259;ng nh&#7853;p chúng tôi khuyên b&#7841;n nên thay &#273;&#7893;i m&#7853;t c&#7911;a b&#7841;n &#273;&#7875; b&#7841;n d&#7877; dàng nh&#7899;.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>If you encounter any problems with logging in please do not </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>hesitate to contact us.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>N&#7871;u b&#7841;n g&#7863;p b&#7845;t k&#7923; tr&#7903; ng&#7841;i nào khi &#273;&#259;ng nh&#7853;p xin &#273;&#7915;ng do d&#7921; hãy liên h&#7879; ngay v&#7899;i chúng tôi .</FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Kindest Regards,</FONT></P>


I have get that information and showed in Website . It likes :


You can login to http://www.escentual.co.uk with this email address

and password combination.

B&#7841;n có th&#7875; &#273;&#259;ng nh&#7853;p vào trang http://www.escentual.co.uk v&#7899;i &#273;&#7883;a ch&#7881; h&#7897;p th&#432; và m&#7853;t kh&#7849;u &#273;&#259;ng nh&#7853;p này

 

When you log in we advise that you change your password to

something more memorable to yourself.

 

Sau khi &#273;ã &#273;&#259;ng nh&#7853;p chúng tôi khuyên b&#7841;n nên thay &#273;&#7893;i m&#7853;t c&#7911;a b&#7841;n &#273;&#7875; b&#7841;n d&#7877; dàng nh&#7899;.

If you encounter any problems with logging in please do not

hesitate to contact us.

 N&#7871;u b&#7841;n g&#7863;p b&#7845;t k&#7923; tr&#7903; ng&#7841;i nào khi &#273;&#259;ng nh&#7853;p xin &#273;&#7915;ng do d&#7921; hãy liên h&#7879; ngay v&#7899;i chúng tôi .

Kindest Regards,



But I want to show only 1/3 that content , like :

You can login to http://www.escentual.co.uk with this email address

and password combination.

B&#7841;n có th&#7875; &#273;&#259;ng nh&#7853;p vào trang http://www.escentual.co.uk v&#7899;i &#273;&#7883;a ch&#7881; h&#7897;p th&#432; và m&#7853;t kh&#7849;u &#273;&#259;ng nh&#7853;p này  ...


How can I do ? It is very hard for me to do , because when I reveived contents , I reveived all ( including html code like in database ) , like :

<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>You can login to http://www.escentual.co.uk with this email address </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>and password combination.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>B&#7841;n có th&#7875; &#273;&#259;ng nh&#7853;p vào trang </FONT><A href="http://www.escentual.co.uk/"><FONT face="Times New Roman" size=3>http://www.escentual.co.uk</FONT></A><FONT face="Times New Roman" size=3> v&#7899;i &#273;&#7883;a ch&#7881; h&#7897;p th&#432; và m&#7853;t kh&#7849;u &#273;&#259;ng nh&#7853;p này </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>When you log in we advise that you change your password to </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>something more memorable to yourself.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Sau khi &#273;ã &#273;&#259;ng nh&#7853;p chúng tôi khuyên b&#7841;n nên thay &#273;&#7893;i m&#7853;t c&#7911;a b&#7841;n &#273;&#7875; b&#7841;n d&#7877; dàng nh&#7899;.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>If you encounter any problems with logging in please do not </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>hesitate to contact us.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT size=3><FONT face="Times New Roman"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>N&#7871;u b&#7841;n g&#7863;p b&#7845;t k&#7923; tr&#7903; ng&#7841;i nào khi &#273;&#259;ng nh&#7853;p xin &#273;&#7915;ng do d&#7921; hãy liên h&#7879; ngay v&#7899;i chúng tôi .</FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Kindest Regards,</FONT></P>

How can I know where to cut that string ? I have did with content.length()/8 , but all I had are :

<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>You can login to http://www.escentual.co.uk with this email address </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>and password combination.</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>B&#7841;n có th&#7875; &#273;&#259;ng nh&#7853;p vào trang </FONT><A href="http://www.escentual.co.uk/"><FONT face="Times New Roman" size=3>http://www.escentual.co.uk</FONT></A><FONT face="Times Ne

And it showed in website with error .
0
Comment
Question by:tunhien
4 Comments
 
LVL 16

Expert Comment

by:suprapto45
ID: 16893667
Hi,

How do you display it to your website? Are you using any JSTL?

David
0
 
LVL 3

Accepted Solution

by:
runa_paathak earned 500 total points
ID: 16899912
Read the first 3 <P> tags in the String returned by the database. Do something like this (this is somewhat a hack, but will work):

String dbString = "string returned by ur db";

int index = -1;
int from = 0;
for (int i=0; i<3; i++)
{
    index = dbString.indexOf("</P>", from);
    from = index + 1;
}
System.out.println(dbString.substring(0, index + 4));

This will print the first 3 <P> tags in your String. Hope this helps.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
timeToIdleSeconds vs timeToLiveSeconds in hibernate second level cache 3 139
login jsp example 24 67
by zero exception 10 52
jsp insert to database example 2 46
Is your phone running out of space to hold pictures?  This article will show you quick tips on how to solve this problem.
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question