javaʵÏÖÑéÖ¤Âë
javaÑéÖ¤ÂëµÄʵÏÖ(Ò»)
ÊÕ²Ø
1.ImageServletÀàµÄʵÏÖ£º
package com.mobile.control;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ImageServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
// Éú³ÉÊý×ÖºÍ×ÖĸµÄÑéÖ¤Âë
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
BufferedImage img = new BufferedImage(68, 22,
BufferedImage.TYPE_INT_RGB);
// µÃµ½¸ÃͼƬµÄ»æÍ¼¶ÔÏó
Graphics g = img.getGraphics();
Random r = new Random();
&
Ïà¹ØÎĵµ£º
ÔÚEclipseÖÐÁ¬ÉÏjavadocsÎĵµ
Ò»¡¢ °²×°Eclipse
¶þ¡¢ ´ÓOracle¹ÙÍø»òÕßsunÒÔǰµÄ¹ÙÍøÉÏÏÂÔØJavaÏàÓ¦µÄdocsÎĵµ
Èý¡¢ & ......
xmlÎļþÈçÏ ÅäÖù¦ÄÜ¿ª¹Ø
<Configurations>
<Samples>true</Samples>
<Excepts>true</Excepts>
<CheckFace>false</CheckFace>
<ThumbNail>false</ThumbNail>
&nbs ......
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet. ......
Jsp
·½Ãæ
jspµÄ³£ÓõÄÃüÁî´ð£ºpage, include, talib, forward,
Servlet
·½Ãæ
1
¡¢ËµÒ»Ëµ
Servlet
µÄÉúÃüÖÜÆÚ
?
´ð:servletÓÐÁ¼ºÃ
µÄÉú´æÆÚµÄ¶¨Ò壬°üÀ¨¼ÓÔØºÍʵÀý»¯¡¢³õʼ»¯¡¢´¦ÀíÇëÇóÒÔ¼°·þÎñ½áÊø¡£Õâ¸öÉú´æÆÚÓÉjavax.servlet.Servlet½Ó¿ÚµÄ
init,serviceºÍdestroy·½·¨±í´ï¡£
2
¡¢
Servlet
°æ±¾¼ä
(
ÍüÁ ......
POIFSFileSystem fs=new POIFSFileSystem(new FileInputStream(cfname));
HSSFWorkbook wb = new HSSFWorkbook(fs);
......