2
我在j2me中有一個從wml/asp頁面獲取字符串和數據的程序。
使用此代碼:使用J2me從WML頁面獲取數據
HttpConnection con = (HttpConnection) Connector.open(
"http://localhost:"+port+"/MobileWebWIthConnection/ShowCourseinsemester.aspx?StudentId="+ID+"&Year="+Year+"&Semester="+Semester);
DataInputStream in = new DataInputStrea(con.openInputStream());
int len = (int) con.getLength();
byte[] info = new byte[len];
in.readFully(info);
result = new String(info);
switchDisplayable(null, getStudentCourses());
stringItem2.setText(result);
當我的J2ME應用程序試圖從該頁面讀取和存儲數據:
"http://localhost:"+port+"/MobileWebWIthConnection/ShowCourseinsemester.aspx?StudentId="+ID+"&Year="+Year+"&Semester="+Semester
其放置在名爲(結果)字符串中的文字是什麼相似下面預期數字:
它走的是內容,而無需如下格式:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<wml>
<card>
<p><b>Student Name :</b> Arin Rizk </p>
<p><b>Student ID</b> : 20111</p>
<p>first Semester ,2011</p>
1 - Course Name : DDD | Credits Number : 3 | Mark : 70 </br> 2 - Course Name : EEE | Credits Number : 3 | Mark : 65 </br> 3 - Course Name : EEE | Credits Number : 3 | Mark : 65 </br> 4 - Course Name : EEE | Credits Number : 3 | Mark : 90 </br>
</card>
</wml>
所以當我分配這個文本它顯示在圖下面的StringItem的。
stringItem2.setText(result);
怎樣才能讓我的J2ME查看字符串作爲原始格式的頁面?