2011-05-11 12 views
1

ブラウザのフィールドにhtmlコンテンツを表示できません。私はUTF-8エンコード方法を使用しました。これは私のHTMLコンテンツBlackberry BrowserフィールドにHTMLコンテンツを表示しますか?

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'><html><head><title></title></head><body><p><strong>WELCOME &hellip; </strong></p> 
<p style="text-align: center;"><span style="color: #003366;">WARNING! - Your life may never be the same after downloading this cool &#039;know yourself&#039; tool&hellip; and it&#039;s fun!</span></p> 
<p><span style="color: #003366;"><strong><em>Understand your relationships with your friends &amp; family!</em></strong></span><br /><br /><span style="color: #003366;">Why can&#039;t I relate to my parents?</span><br /><span style="color: #003366;">Why do I argue with my best friend?</span><br /><br /><span style="color: #003366;"><em><strong>Find your Love-Match &ndash; in your fantasy or for real!</strong></em></span><br /><br /><span style="color: #003366;">Is my boyfriend/girlfriend right for me?</span><br /><span style="color: #003366;">How does my personality affect my sex-life?</span><br /><br /><span style="color: #003366;"><em><strong>Compare your personality with your favorite celebrity or sports star!</strong></em></span><br /><br /><span style="color: #003366;">What about &hellip;</span><br /><span style="color: #003366;">Paris Hilton? Tom Cruise? Hannah Montana? Justin Bieber? Taylor Swift?</span><br /><span style="color: #003366;">Mick Jagger? Ronaldo? or Justin Timberlake? &hellip; to name a few! </span><br /><span style="color: #003366;">More than 500 Musicians/Pop Stars, Sports Stars, Celebrities, Film Stars etc. online&hellip;! </span><br /><br /><span style="color: #003366;"><em><strong>Make the right career choice!</strong></em></span><br /><br /><span style="color: #003366;">What type of job will suit me best?</span><br /><br /><br /><span style="color: #003366;"><strong>It&rsquo;s all about &hellip; </strong></span><strong><span style="color: #ffcc00;">p</span><span style="color: #ffcc00;">ersonalit</span><span style="color: #ffcc00;">y</span><em><span style="color: #003366;">, </span></em><span style="color: #ff0000;">personality</span><em><span style="color: #003366;">, </span></em><span style="color: #3366ff;">per</span><span style="color: #3366ff;">sonality</span><span style="color: #003366;">!</span></strong><br /><br /> <br /><span style="color: #003366;">Simply <strong>answer 15 questions</strong> and &#039;<span style="color: #ff0000;">click</span>&#039; to generate a report that gives you a <strong>unique personality profile</strong> including your <span style="text-decoration: underline;"><strong>individual</strong></span> combination of </span><strong><span style="color: #ffcc00;">YELLOW</span></strong><span style="color: #003366;">, </span><strong><span style="color: #ff0000;">RED</span></strong><span style="color: #003366;"> and </span><strong><span style="color: #3366ff;">BLUE</span></strong><span style="color: #003366;"> personality traits. </span><br /><br /><span style="color: #003366;"><strong>Press the &#039;</strong></span><strong><span style="color: #3366ff;">HELP</span></strong><span style="color: #003366;"><strong>&#039; function if you want to read more about the different personality types and our system of color coding.</strong></span><br /><span style="color: #003366;"><strong>Complete your test, then you can check your <span style="color: #ff0000;">celebrity love match</span> and check your personality with your friends, family and your choice of over 500 stars we have already listed online.</strong></span><br /><br /><span style="color: #003366;"><strong>And what about <span style="color: #ff0000;">your sexuality</span>??? &hellip; and </strong></span><strong><span style="color: #3366ff;">career choice</span></strong><span style="color: #003366;"><strong>???</strong></span><br /><br /><span style="color: #003366;"><strong>You can do 10 tests/reports and comparisons with family and friends <span style="color: #ff0000;">PLUS unlimited celebrity comparisons &hellip; DO IT NOW!</span></strong></span><br /><br /><span style="color: #003366;"><strong>This system is so simple, <span style="color: #ff0000;">quick</span>, easy and </strong></span><strong><span style="color: #3366ff;">accurate</span></strong><span style="color: #003366;"><strong> - it will amaze you!</strong></span><br /><br /></p> 
<p style="text-align: center;"><span style="color: #003366;"><strong>LET THE FUN BEGIN &hellip; Go test yourself!</strong></span><br /><br /><img title="Take the test" src="http://www.personality-abc.frankmanson.com/website/admin/UserFiles/Image/Sales/take-the-test-sml.gif" alt="Take the test" width="150" height="88" /></p></body></html> 

であり、これは私のコード

私は問題が何であるかを知らない
contentField=new BrowserField();    
contentField.displayContent(content,"http://localhost"); 

です。

答えて

1

は、以下のことを試してみてください。

BrowserFieldConfig config = new BrowserFieldConfig(); 
HttpHeaders headers = new HttpHeaders(); 
headers.addProperty(HttpHeaders.HEADER_CONTENT_TYPE, HttpHeaders.CONTENT_TYPE_TEXT_HTML); 
headers.addProperty(HttpHeaders.HEADER_ACCEPT_CHARSET, "UTF-8"); 
config.setProperty(BrowserFieldConfig.HTTP_HEADERS, headers); 
BrowserField contentField = new BrowserField(config); 
this.add(contentField); // add to screen 
contentField.displayContent(content,"http://localhost"); // content -> your HTML content 
関連する問題