jsp Éú³É¾²Ì¬Ò³Ãæ
/**
* @file_name ÎļþÃû¼°ÎļþÖ®ºóµÄ²ÎÊý.×îºÃΪa.jsf?fileId=aaaa
* @path ÎļþËùÔڵķ¾¶.Ïà¶ÔÓÚ¸ùĿ¼¶øÑÔµÄ.
* @realNameÎļþÒª±£´æµÄÃû×Ö
* @realPathÎļþÒª±£´æµÄÕæʵ·¾¶¡£Ä¬ÈÏÓëÎļþËùÔÚµÄĿ¼Ïàͬ¡£
*/
public class ToHtmlPath extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String url = "";
String name = "";
ServletContext sc = getServletContext();
String file_name = request.getParameter("file_name");// ÄãÒª·ÃÎʵÄjspÎļþ,Èçnews.jsf¡£
// file_nameÈ磺fileDetail.jsf?fileId=56.ÒªÊÇÓвÎÊý£¬ Ö»ÓÐÒ»¸ö²ÎÊý¡£²¢ÇÒÒÔ²ÎÊýÃû×÷ΪÎļþÃû¡£
String realName = request.getParameter("realName");// Òª±£´æµÄÎļþÃû¡£Èçaaa;×¢Òâ¿ÉÒÔûÓÐÕâ¸ö²ÎÊý¡£
String path = request.getParameter("path");// ÄãÒª·ÃÎʵÄjspÎļþ·¾¶¡£Èçnews¡£×¢Òâ¿ÉÒÔûÓÐÕâ¸ö²ÎÊý¡£
String realPath = request.getParameter("realPath");// ÄãÒª±£´æµÄÎļþ·¾¶,ÈçhtmlNews.×¢Òâ¿ÉÒÔûÓÐÕâ¸ö²ÎÊ
Ïà¹ØÎĵµ£º
JSP ʵÔÚservlet Ö®ºó·¢Õ¹ÆðÀ´µÄ¼¼Êõ¡£
ÔËÐлúÖÆ£º
1£ºjspÎļþÌá½»·þÎñÆ÷£¬·þÎñÆ÷ £¨Tomcat£©£¬³õʼ»¯ ÇëÇóºÍÏìÓ¦¶ÔÏó £¬È»ºóÅжÏjspÎļþÊÇ·ñ´æÔÚ £¬Èç¹û²»´æÔÚ 404 ´íÎ󣬴æÔÚ £¬±àÒë³ÉΪ ¡£java Îļþ ----¡·¡£class Îļþ ¡£¾ÍÊÇÒ»¸öjavaµÄÀà £¬Õâ¸öÀà £¬¼Ì³Ð×Ô httpjspbase £¬Õâ¸öhttpjsppageÀà ÓÖ ÊµÏÖÁË» ......
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%@ page import="java.io.*,java.sql.*,net.sf.jasperreports.engine.*" %>
<%@ page import="com.microsoft.sqlserver.jdbc.SQLServerDriver" %>
<%@ include file="/common/header.jsp" %>
<!DOCTYPE HTM ......
ʲôÊÇ×Ô¶¨Òå±êÇ©£¿
1£¬Óû§×Ô¶¨ÒåµÄJavaÓïÑÔÔªËØ, ʵÖÊÊÇÔËÐÐÒ»¸ö»òÕßÁ½¸ö½Ó¿ÚµÄJavaBean;
2£¬¿ÉÒԷdz£½ôÃܵغÍJSPµÄ±íʾÂß¼ÁªÏµÔÚÒ»Æð£¬ÓÖ¾ßÓкÍÆÕͨJavaBeanÏàͬµÄÒµÎñÂß¼´¦ÀíÄÜÁ¦;
3£¬µ±Ò»¸öJSPÒ³Ãæת±äΪservletʱ£¬Æä¼äµÄÓû§×Ô¶¨Òå±êǩת»¯Îª²Ù×÷Ò»¸ö³ÆΪ±êÇ©handerµÄ¶ÔÏó;
4£¬¿É²Ù×÷ĬÈ϶ÔÏ󣬴¦Àí±íµ¥Êý¾Ý£¬ ......
JFreeChartÊÇÒ»×鹦ÄÜÇ¿´ó¡¢Áé»îÒ×ÓõÄJava»æͼAPI£¬Ê¹ÓÃËü¿ÉÒÔÉú³É¶àÖÖͨÓÃÐԵı¨±í£¬°üÀ¨Öù״ͼ¡¢±ýͼ¡¢ÇúÏßͼ¡¢¸ÊÌØͼµÈ¡£ËüÄܹ»ÓÃÔÚSwingºÍWebµÈÖÐÖÆ×÷×Ô¶¨ÒåµÄͼ±í»ò±¨±í£¬²¢Çҵõ½¹ã·ºµÄÓ¦Óᣱ¾ÎĽ«Í¨¹ýÒýÁì¶ÁÕßѧϰÔÚJFreeChartÖбýͼ¡¢Öù״ͼºÍÇúÏßͼµÄ½ø½×Ó¦Óã¬À´´ïµ½ÊìÁ·Ê¹ÓÃJFreeChartµÄÄ¿µÄ¡£
Ò»£® &nb ......
ËÄ£®ÇúÏßͼ
½Ó×ÅÎÒÃÇÀ´½éÉÜÇúÏßͼµÄʹÓá£ÔÚ±ÊÕßÈÕ³£µÄ¿ª·¢¹¤×÷ÖУ¬ÇúÏßͼÓõÃ×î¶à£¬Ëü¿ÉÒÔÓÃÀ´»æÖÆÇ÷ÊÆͼ¡¢Í³¼Æ·ÖÎöµÈ¡£Ê×ÏÈÎÒÃÇÔÚWebRootϽ¨Á¢Ò»¸ölineĿ¼£¬ÓÃÀ´´æ·ÅÇúÏßͼʵÀýµÄjspÒ³Ãæ¡£ÎÒÃÇÔÚ¸ÃĿ¼Ï½¨Á¢sample1.jspÒ³ÃæÀ´×öÒ»¸ö¼òµ¥µÄÇúÏßͼµÄÀý×Ó¡£ÔÚ¿ªÊ¼±àÂëÇ°£¬ÈÃÎÒÃÇÀ´¿´¿´Óë»ÇúÏßͼÃÜÇÐÏà¹ØµÄ¼¸¸öÀࣺ
1£© ......