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

Jsp³£Óü¼ÇÉ:ͼƬÑéÖ¤Âë

Jsp³£Óü¼ÇÉ:ͼƬÑéÖ¤Âë
2009Äê10ÔÂ30ÈÕ ÐÇÆÚÎå 21:06
˼·
£º
ͼƬÑéÖ¤ÂëµÄʵÏÖÖ÷ÒªµÄ¼¼ÊõµãÊÇÈçºÎÉú³ÉÒ»¸öͼƬ¡£Éú³ÉͼƬ¿ÉÒÔʹÓÃjava.awt°üϵÄÀàÀ´ÊµÏÖ¡£ÎÒÃÇÏÈдһ¸ö¼òµ¥µÄÉú³ÉͼƬµÄ³ÌÐòHelloImage.java¡£ÒÔÏÂÊÇ´úÂ벿·Ö¡£
package com.vogoal.test;
import java.awt.Color;
import
java.awt.Graphics;
import java.awt.image.BufferedImage;
import
java.io.File;
import java.io.IOException;
import
javax.imageio.ImageIO;
/**
* @author SinNeR@blueidea.com
* create a
image
*/
public class HelloImage {
    public static void main(String[]
args){
        BufferedImage image = new BufferedImage(80,
25,
                BufferedImage.TYPE_INT_RGB);
        Graphics g =
image.getGraphics();
        g.setColor(new Color(255,255,255));
       
g.fillRect(0, 0, 80, 25);
        g.setColor(new Color(0,0,0));
       
g.drawString("HelloImage",6,16);
        g.dispose();
       
try{
            ImageIO.write(image, "jpeg", new
File("C:\\helloImage.jpeg"));
        }catch(IOException e){
           
e.printStackTrace();
        }
    }
}
±àÒëºó£¬ÔÚDOSϵ÷ÓÃÕâ¸ö³ÌÐò£¬Õý³£Çé¿öÏ£¬»áÔÚCÅ̸ùĿ¼ÏÂÉú³ÉÒ»ÕÅÃû×ÖhelloImage.jpegΪµÄͼƬ¡£Í¼Æ¬ÉÏÓÐÎÄ×ÖHelloImage¡£
¼òµ¥½éÉÜÏÂÉú³ÉͼƬµÄÁ÷³Ì
£º
½¨Á¢BufferedImage¶ÔÏó¡£Ö¸¶¨Í¼Æ¬µÄ³¤¶È¿í¶ÈºÍÉ«²Ê¡£
BufferedImage image = new
BufferedImage(80,25,BufferedImage.TYPE_INT_RGB);
È¡µÃGraphics¶ÔÏó£¬ÓÃÀ´»æÖÆͼƬ¡£
Graphics g = ima


Ïà¹ØÎĵµ£º

JSP¾Å´óÄÚÖöÔÏó¼°Ëĸö×÷ÓÃÓò

¾Å´ó¶ÔÏó£º
ÄÚÖöÔÏó£¨ÓÖ½ÐÒþº¬¶ÔÏó£¬ÓÐ9¸öÄÚÖöÔÏó£©:²»ÐèÒªÔ¤ÏÈÉùÃ÷¾Í¿ÉÒÔÔڽű¾´úÂëºÍ±í´ïʽÖÐËæÒâʹÓÃ
1-out:
 javax.servlet.jsp.JspWriterÀàÐÍ£¬´ú±íÊä³öÁ÷µÄ¶ÔÏó¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©
request£ºjavax.servlet.ServletRequestµÄ×ÓÀàÐÍ£¬´Ë¶ÔÏó·â×°ÁËÓÉWEBä¯ÀÀÆ÷»òÆäËü¿Í»§¶ËÉú³ÉµØHTTP
ÇëÇóµÄϸ½Ú ......

jspÖе¼Èë³£ÓñêÇ©

<%@taglib prefix="s" uri="/WEB-INF/tld/struts-tags.tld"  %>
<%@taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="dec ......

´¿JSP·ÖÒ³´úÂë

<%@ page contentType="text/html; charset=gb2312" %>
<%@ page language="java" %>
<%@ page import="java.sql.*" %>
<%
//Çý¶¯³ÌÐòÃû
String driverName="org.gjt.mm.mysql.Driver";
//Êý¾Ý¿âÓû§Ãû
String userName="root";
//ÃÜÂë
S ......

MyEclipse¸ü¸Äjsp±à¼­Ê±×ÖÌå

     Ò»Ö±ÒÔÀ´Ê¹ÓÃMyeclipse±à¼­Ê±£¬¸Ð¾õÔ­ÓеÄ×ÖÌå´óСºÜ²»ÊÊÓ¦£¬ÓÚÊÇÔÚÍøÉÏËÑÁ˹ØÓÚÔÚMyEclipseÖÐÔõÑùÐÞ¸Ä×ÖÌå´óС£¬ºÜ¶à¶¼ÊÇʹÓÃwindow-preferences-general-apperaence-colors and fonts-java-java edditor text font À´ÐÞ¸Ä×ÖÌå¡£
    ʹÓÃÕâ¸ö·½·¨ËäȻдÀàÎļþÀïÃæµÄ´óС¶¼¸ü¸ü¸ ......

JSP±à³Ì½ø¶ÈÌõÉè¼ÆʵÀý

Ðí¶àWebÓ¦Óá¢ÆóÒµÓ¦ÓÃÉæ¼°µ½³¤Ê±¼äµÄ²Ù×÷£¬ÀýÈ縴ÔÓµÄÊý¾Ý¿â²éѯ»ò·±ÖصÄXML´¦ÀíµÈ£¬ËäÈ»ÕâЩÈÎÎñÖ÷ÒªÓÉÊý¾Ý¿âϵͳ»òÖмä¼þÍê³É£¬µ«ÈÎÎñÖ´ÐеĽá¹ûÈÔ¾ÉÒª½èÖúJSP²ÅÄÜ·¢Ë͸øÓû§¡£±¾ÎĽéÉÜÁËÒ»ÖÖͨ¹ý¸Ä½øÇ°¶Ë±íÏÖ²ãÀ´¸ÄÉÆÓû§¸Ð¾õ¡¢¼õÇá·þÎñÆ÷¸ºÔصİ취¡£
µ±JSPµ÷ÓÃÒ»¸ö±ØÐ볤ʱ¼äÔËÐеIJÙ×÷£¬ÇҸòÙ×÷µÄ½á¹û²»ÄÜ£¨ÔÚ·þÎñ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ