怎样把存入数据库中的*.doc或*.html文件读出到指定的窗口中
如题。请各位大侠多给点意见。
从数据库中往外读:
String messid= " ";
String strExt= " ";
String sql = " ";
String title = " ";
messid=request.getParameter( "messid ");
String content=request.getParameter( "id ")==null? " ":request.getParameter( "id ");
if(! " ".equals(content))
content= " and id= "+content;
DB = new cscec.database.sysdbcon();
sql = "select AFFIXNAME,AFFIX_EXTEND,AFFIX from of_messAffix where mess_id= " + messid ;
System.out.println(sql);
//System.out.println(title+ "----- ");
rs = DB.executeQuery(sql);
sos = response.getOutputStream();
while(rs.next())
{//1
strExt=rs.getString( "affix_extend ");
response.reset();
if(strExt.equalsIgnoreCase( "doc "))
{
response.setContentType( "application/msword ");
}
else if(strExt.equalsIgnoreCase( "xls "))
{
response.setContentType( "application/vnd.ms-excel ");
}
else if(strExt.equalsIgnoreCase( "jpg "))
{
response.setContentType( "image/jpeg ");
}
else if(strExt.equalsIgnoreCase( "txt ")) //txt文件的显示
{
response.setContentType( "text/plain ");
}
else if(strExt.equalsIgnoreCase( "jpeg "))
{
response.setContentType( "image/jpeg ");
}
else if(strExt.equalsIgnoreCase( "gif "))
{
response.setContentType( "image/gif ");
}
else if(strExt.equalsIgnoreCase( "bmp "))
{
response.setContentType( "image/bmp ");
}
else
{
response.setContentType( "application/octet-stream ");
&