Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JSPÉú³ÉWORDÎĵµ£¬EXCELÎĵµ£¬PDFÎĵµ

ÔÚweb-oaϵͳÖÐ,¹«ÎĹÜÀíºÃÏ󲻿ɻòȱ,ÓÐʱÐèÒª´ÓÊý¾Ý¿âÖвéѯһЩÊý¾ÝÒÔijÖÖ¸ñʽÊä³öÀ´£¬²¢ÒÔwordÎĵµµÄÐÎʽչÏÖ£¬ÓÐʱÐí¶àwordÎĵµ±£´æµ½Êý¾Ý¿âÖеÄij¸ö±íµÄBlob×Ö¶ÎÀ·þÎñÆ÷Ôٰѱ£´æÔÚBlob×Ö¶ÎÖеÄͼƬÎļþÕ¹ÏÖ¸øÓû§¡£Í¨¹ýÍøÉϲéÕÒ·¢ÏÖºÜÉÙÓйØÓÚ´ËÀàµÄÎÄÕ£¬ÏÖÔÚÕûÀíÆðÀ´¹©´ó¼Ò²Î¿¼¡£
1 ÔÚclient¶ËÖ±½ÓÉú³ÉwordÎĵµ
ÔÚjspÒ³ÃæÉÏÉú³ÉwordÎĵµ·Ç³£¼òµ¥£¬Ö»Ðè°ÑcontentType=”text/html”¸ÄΪcontentType="application/msword; charset=gb2312"¼´¿É£¬´úÂëÈçÏÂ:
<%@ page contentType="application/msword; charset=gb2312" %>
ͨ¹ýÉèÖÿÉÒÔʹԭÀ´Ò³ÃæµÄÄÚÈÝÔÚwordÖбíÏÖ³öÀ´¡£
Èç¹ûÐèÒª°ÑwordÎĵµÏÂÔØÏÂÀ´£¬Ö»ÐèÔÚjspÒ³ÃæÉÏÃæ¼ÓÉÏÈçÏ´úÂ룺
<%
       response.setHeader("Content-Disposition", "attachment;filename=filename.doc");
%>
ÆäÖÐfilename.docÖÐfilenameÊÇÒªÏÂÔصÄwordÎĵµµÄÎļþÃû£¬¿ÉÒÔͨ¹ý<%=docName%>À´×ÔÐж¨ÖÆ£¬ÈçÏÂ
<%
     response.setHeader("Content-Disposition", "attachment;filename=<%=docName%>.doc");
%>
ÕâÑùÌṩһ¸öÌáʾÐÅÏ¢¹©Óû§Ñ¡ÔñÈçÏÂͼËùʾ
С¼¼ÇÉ£ºÈç¹û³ÌÐòÔ±ÐèÒªÔÚÉú³ÉwordÎĵµµÄʱºò°´ÕÕ×Ô¼ºÔ¤ÏÈÔÚwordÉÏÉè¼ÆºÃµÄ¸ñʽ£¬¿ÉÒÔ¸´ÖÆword¸ñʽȻºóÕ³Ìùµ½frontpageÖУ¬È¡html´úÂëÌùµ½jspÒ³Ãæ¼´¿É¡£
2 ÔÚ¿Í»§¶ËÊä³ö´æÔÚÊý¾Ý¿âÖеÄwordʵÌå
ÕâÀïÖ»ÌÖÂÛÔÚclientÊä³öoracleÖÐBLOB×Ö¶ÎÖеÄwordÎĵµÊµÌå¡£ÆäÖе÷ÓÃÁËÀàgetBlobBean£¬¸ÃÀàÌṩÁË´ÓoracleÖÐÈ¡³öblob¹¦ÄÜ£¬´úÂëÈçÏ£º
package yourpackage;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import oracle.sql.*;
import beans.yourbeanpackage. getBlobBean;
public class GetBlobServlet1 extends HttpServlet {
//ÉèÖÃÊä³öÄÚÈÝÀàÐÍ£¬Õâ¸öÉèÖúÜÖØÒª,·ñÔò¿Í»§¶Ëä¯ÀÀÆ÷²»ÄÜʶ±ðÊä³öÄÚÈÝ,µ¼Öµ¯³öÏÂÔصĶԻ°¿ò¡£
  private static final String CONTENT_TYPE = "application/msword;charset=gb2312";
  //Initialize global variables
  public void init() throws&nbs


Ïà¹ØÎĵµ£º

Ô¤±àÒëJSPµÄANT½Å±¾ (¼æÈÝtomcat5ºÍtomcat6)

<project name="jspToServletToClass" default="jsp2servlet2class" basedir=".">

<!-- set global properties for this build -->
<property environment="env" />
<property name="src" location="F:\JspC\src\" />
< ......

tomcat¡¢JDKºÍJSPÅäÖÃ

¾­³£¿´µ½Ðí¶àÈËÎÊÈçºÎÅäÖÃJDKºÍJSP£¬ÏÖÔÚÎÒ°Ñ·½·¨×ܽáÏ£¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
µÚÒ»²½£ºÏÂÔØjdkºÍtomcat
µÚ¶þ²½£º°²×°ºÍÅäÖÃÄãµÄjdkºÍtomcat£ºÖ´ÐÐjdkºÍtomcatµÄ°²×°³ÌÐò£¬È»ºóÉèÖð´ÕÕ·¾¶½øÐа²×°¼´¿É¡£
1.°²×°j2sdkÒÔºó£¬ÐèÒªÅäÖÃһϻ·¾³±äÁ¿£¬ÔÚÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿->ϵͳ±äÁ¿ÖÐÌí¼ÓÒÔÏ»· ......

ServletÓëJSPÖÐÒ³ÃæÌøתµÄÇø±ð

Ò»Ö±¶ÔServletµÄ¼¸ÖÖÒ³ÃæÌøת·½Ê½£¬Àí½âµÄºýÀïºýÍ¿µÄ£¬½ñÌìÔÚÍøÉÏËÑÁËÒ»°Ñ£¬ÕÒµ½Ò»±é±È½ÏºÃµÄ£¬¼ÇÏÂÀ´£¬ÒÔºó¿´¿´¡£
  Ìøת·ÖÁ½²¿·Ö£¬Ò»ÊÇ·¢ÉúÔÚservlet£¬Ò»ÊÇÔÚJSP£¬ÆäʵJSPÒ²¾ÍÊÇservlet£¬²»¹ý»¹ÊÇÓеã²îÒìµÎ¡£
Servlet£º
µ±È»£¬ÔÚservletÖУ¬Ò»°ãÌøת¶¼·¢ÉúÔÚdoGet, doPostµÈ·½·¨ÀïÃæ¡£
1)  redirect · ......

JSPµÄ¾Å¸öÒþº¬¶ÔÏó

Ò»¡¢page ¶ÔÏó
    page¶ÔÏó´ú±íJSP±¾Éí£¬¸ü׼ȷµØ˵Ëü´ú±íJSP±»×ªÒëºóµÄServlet£¬Ëü¿ÉÒÔµ÷ÓÃServletÀàËù¶¨ÒåµÄ·½·¨¡£
    
¶þ¡¢config ¶ÔÏó
    config ¶ÔÏóÀï´æ·Å×ÅһЩServlet ³õʼµÄÊý¾Ý½á¹¹¡£
    config& ......

ÓÃjsp:include ¿ØÖƶ¯Ì¬ÄÚÈÝ

Çåµ¥ 1. JSP include αָÁî
<![CDATA[
<%@ page language="java" contentType="text/html" %>
<html>
<head>
<title>newInstance.com</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<link href="/styles/default.css" ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ