JSPÔà»°¹ýÂËÆ÷µÄʵÏÖ
JSPÔà»°¹ýÂËÆ÷µÄʵÏÖ
²»¹ÜÊÇJSP»¹ÊÇServlet£¬ÆäFilter¹ýÂËÆ÷¶¼ÊÇÒ»¸ö¶«Î÷¡£ÒòΪJSPµÄ±¾ÖʾÍÊÇServlet£¬Ö»²»¹ýÊDZ»°ü×°ÁËһϣ¬³ÉÁ˱ê×¼£¬ÈÃWeb·þÎñÆ÷¶¼×ñÑÕâ¸ö±ê×¼À´½âÎö±àÒëÖ´ÐжøÒÑ¡£
ÒÔÏÂÑÝʾµÄ¾ÍÊÇÔÚJSPÖÐÈçºÎ¹ýÂËÔà»°£¨ServletµÄ´¦Àí·½Ê½Ò²²î²»¶à£©¡£
Ò»¡¢¹ýÂËÆ÷Àà
package com.filter;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
public class WordsFilter implements Filter {
private Map< String, String>map = new HashMap< String, String>();
// ¹ýÂËÆ÷µÄ³õʼ»¯
public void init(FilterConfig config) throws ServletException {
String filePath = config.getInitParameter("filePath");
// ´ÓÅäÖÃÎļþÖÐÈ¡µÃÎļþµÄÏà¶Ô·¾¶
Servl
Ïà¹ØÎĵµ£º
Ðí¾ÃûÓеǼ×Ô¼ºµÄУÄÚÍøÁË£¬½ñÌìµÇ¼ÁËһϣ¬ºöÈ»·¢ÏÖУÄÚµÄÉÏ´«ÕÕƬͦÓÐÒâ˼µÄ£¬ÓÚÊǺõ¾Í´ÓÍøÉÏÕÒÁËһϣ¬Ð£ÄÚÓ¦¸ÃÊÇʹÓÃjspдµÄ¡£ÔÚÍøÉÏÕÒµ½Á˸öFileUpload¿Ø¼þ£¬¿ÉÒԺܷ½±ãµÄÉÏ´«Îļþ¡£ÔÚÍøÉÏÕÒµ½Ò»ÆªÏêϸ½éÉÜÕâ¸ö¿Ø¼þʹÓõģ¬ÊÔÑéÁËһϣ¬¸ãÁ˺þòÅʵÏÖÏÖÔÚÕûÀí³öÀ´¡£
Ò»¡¢Ê× ......
ÎÒÒªµ÷ÓÃJExcelApi ¶ÁÈ¡Óû§ÔÚ¿Í»§¶ËÑ¡ÔñµÄExcelÖеÄÎļþÖеÄÊý¾Ý£¬
ÎÒÊÇÕâÑù×öµÄ£º
Ê×ÏÈ×öÒ»¸öÒ³ÃæupLoadExcel.jspÈÃÓû§Ñ¡Ôñ±¾µØµÄExcelÎļþ£¬ÎÒ¾ÍÊÇÓõÄÉÏ´«µÄÄǸöÒ³Ã棺
<!DOCTYPE HTML PUBLIC "-//W3C//DTD &nb ......
±¾ÀýÊDzÉÓÃJSP + Ajax + Îı¾À´ÑÝʾ¶àÑ¡¡¢È«Ñ¡£¬Ìí¼Ó¡¢É¾³ý¡¢¸üÐÂcheckbox¶àÑ¡¿òµÄЧ¹û£»³ä·ÖÕ¹ÏÖÁËÀûÓÃJavaScript¿ØÖÆHTML DOMÒÔ¼°ÀûÓÃXML http ´«µÝÊý¾Ý£¬ÀûÓÃJSP²Ù×÷Îı¾µÄЧ¹û¡£
¡¡¡¡1.JavaScript ÓÃÀ´¿ØÖÆÒ³ÃæÄÚÈݵÄÏÖʵÓëÔöɾЧ¹û£»
¡¡¡¡2.JSP×÷Ϊºǫ́£¬¶ÔÎı¾½øÐжÁÈ¡¡¢Ð´Èë¡¢¸üеȲÙ×÷£»
¡¡¡¡3.Îı¾¸ñʽÊÇÓÃÀ´´ ......
get
jsp url ${param.serialID}
action jsp String commentId = ServletActionContext.getRequest().getParameter("commentId");
-- ......
<SCRIPT LANGUAGE="javascript">
//Ö¸¶¨Ò³ÃæÇøÓòÄÚÈݵ¼ÈëWord
function AllAreaWord() {
var oWD = new ActiveXObject("Word.Application");
var oDC = ......