换行要你自己来做吧?
the following example shows how to display query result in webpage:private String formatResult(ResultSet rset) throws SQLException {
StringBuffer sb = new StringBuffer();if (!rset.next())
sb.append("<P> No matching rows.<P>\n");
else { sb.append("<UL>");
do { sb.append("<LI><font size=5>" +"""+ rset.getString(1)+"""+ " "+ rset.getString(2)+
" "+"published in"+" "+rset.getDate(3)+".</font></LI>\n");
} while (rset.next());
sb.append("</UL>");
}
return sb.toString();
}
the following example shows how to display query result in webpage:private String formatResult(ResultSet rset) throws SQLException {
StringBuffer sb = new StringBuffer();if (!rset.next())
sb.append("<P> No matching rows.<P>\n");
else { sb.append("<UL>");
do { sb.append("<LI><font size=5>" +"""+ rset.getString(1)+"""+ " "+ rset.getString(2)+
" "+"published in"+" "+rset.getDate(3)+".</font></LI>\n");
} while (rset.next());
sb.append("</UL>");
}
return sb.toString();
}
public static String returnToBr(String sStr)
{
if (sStr == null || sStr.equals(""))
{
return sStr;
} StringBuffer sTmp = new StringBuffer();
int i = 0;
while (i <= sStr.length()-1)
{
if (sStr.charAt(i) == '\n'||sStr.charAt(i)=='\r')
{
sTmp = sTmp.append("<br>");
} else if (sStr.charAt(i)==' ')
{
sTmp = sTmp.append(" ");
}else
{
sTmp = sTmp.append(sStr.substring(i,i+1));
}
i++;
}
String S1;
S1=sTmp.toString();
return S1;
} %>
用这个函数转换一下就好了
即把:\r\n转换成<br>