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

JSPÉú³É¾²Ì¬Ò³Ãæ

JDK 1.5 +ECLIPSE +TOMCAT 5.0.28 + MYSQL 5.0
Êý¾Ý¿âTEST¡¡£¬±íÃûnews
×ֶΣº¡¡id    int ×Ô¶¯Ôö³¤¡¡, Title   varchar(20) , Content   varchar(200)   , Author   varchar(10)
makeFile.jsp
<%
   Connection conn = DBconn.getConnection();
   Statement stmt = conn.createStatement();
   ResultSet Rs = stmt.executeQuery("select * from news");
   System.out.println("success");
%>
   <%
  
   String filePath = request.getRealPath("/")+"template.htm";
   System.out.println(filePath);
  
   String templateContent;
   FileInputStream fileinputstream = new FileInputStream(filePath);
   int lenght = fileinputstream.available(); //available() ·µ»Ø¿ÉÒÔ²»ÊÜ×èÈûµØ´Ó´ËÎļþÊäÈëÁ÷ÖжÁÈ¡µÄ×Ö½ÚÊý¡£
  
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes); //read(byte[] b) ´Ó´ËÊäÈëÁ÷Öн«×î¶à b.length ¸ö×Ö½ÚµÄÊý¾Ý¶ÁÈëÒ»¸ö×Ö½ÚÊý×éÖС£
fileinputstream.close();
//templateContent = new String(bytes);
String title;
String content;
String author;
while(Rs.next())
{
templateContent = new String(bytes);//Èç¹û²»ÓÃÕâ¾ä£¬ÔòÌæ»»Ò»´ÎÖ®ºó£¬templateContentÖоÍûÓÐ#**#±êÖ¾ÁË¡£ËùÒÔÒªÖØÐÂÉú³É
title = Rs.getString("Title");
content = Rs.getString("Content");
author = Rs.getString("Author");
out.println(title+"********"+content+"****"+author);
out.print("ÒÔÏÂÊÇÄ£°åÄÚÈÝ£º<br>"+templateContent+"<br> ÒÔÏÂÊÇÖû»ÒÔºóµÄhtmlÄÚÈÝ<br><hr>");
templateContent=templateContent.replaceAll("#title#",title);
templateContent=templateContent.replaceAll("#author#",author);//Ìæ»»µôÄ£¿éÖÐÏàÓ¦µÄµØ·½
templateContent=templateContent.replaceAll("#content#",content);
// ¸ù¾Ýʱ¼äµÃÎļþÃû
Calendar calendar = Calendar.getInstance();
String fileame = String.valueOf(calendar.getTimeInMillis()) +".html";
fileame = request.getRealPath("/")+"Html/"+fileame;//Éú³ÉµÄhtmlÎļþ±£´æÂ·¾¶
out.print(


Ïà¹ØÎĵµ£º

[×ªÔØ]JSP PO VO BO DTO POJO DAO½âÊÍ

 PO £ºpersistent object³Ö¾Ã¶ÔÏó
1 £®ÓÐʱҲ±»³ÆÎªData¶ÔÏ󣬶ÔÓ¦Êý¾Ý¿âÖеÄentity£¬¿ÉÒÔ¼òµ¥ÈÏΪһ¸öPO¶ÔÓ¦Êý¾Ý¿âÖеÄÒ»Ìõ¼Ç¼¡£
2 £®ÔÚhibernate³Ö¾Ã»¯¿ò¼ÜÖÐÓëinsert/delet²Ù×÷ÃÜÇÐÏà¹Ø¡£
3 £®POÖв»Ó¦¸Ã°üº¬ÈκζÔÊý¾Ý¿âµÄ²Ù×÷¡£
---------------------------------------------------------
POJO £ºpla ......

linuxϵͳµÄ°²×°(redhat7.2)+jsp»·¾³+mysql+°²È«ÉèÖÃ

 1 1 Linux Red Hat 7.2 °²×°
¡¡¡¡Red Hat Linux 7.2µÄ°²×°¹âÅ̹²ÓÐÁ½ÕÅ£ºµÚÒ»ÕÅ¿ÉÒÔÖ±½Ó´Ó¹âÅÌÆô¶¯£¬°üº¬Á˴󲿷ֵÄÈí¼þ°üºÍһЩ°²×°¹¤¾ß£»µÚ¶þÕŹâÅ̳ýÁ˸½¼ÓµÄÈí¼þ°üÍ⣬Ö÷ÒªÊÇÔ´Âë¡¢Ô¤ÀÀ°æÈí¼þµÈ¡£
¡¡¡¡Red Hat Linux 7.2µÄ°²×°½çÃæ·Ç³£ÓѺã¬×óÃæÓм´Ê±Ï꾡µÄ°ïÖúÐÅÏ¢£¬ÓÒÃæÊÇÑ¡ÏÍêȫ֧³ÖÊó±ê²Ù×÷¡£
¡¡¡¡½« ......

JSPÖÐincludeÖ¸ÁîºÍincludeÐÐΪµÄÇø±ð

 
ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
< %@ include file=” ”%>
< jsp:include page=” ” flush=”true”/>
¡¡¡¡Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐÎªÔªËØ¡£¾ßÌåËüÃǽ«Ôںδ¦Óã¿ÈçºÎÓü°ËüÃÇÓÐÊ²Ã´Çø±ð£¿ÕâÓ¦¸ÃÊǺܶàÈË¿´µ½Ëü¶¼»áÏëµ½µÄÎÊÌâ¡£ÏÂÃæÒ»ÆðÀ´¿´¿´°É¡£
¡ ......

jspÄÚÖöÔÏó[9ÖÖ]


JSP¹²ÓÐÒÔÏÂ9ÖÖ»ù±¾ÄÚÖÃ×é¼þ£¨¿ÉÓëASPµÄ6ÖÖÄÚ²¿×é¼þÏà¶ÔÓ¦£©£º
¡¡¡¡request
Óû§¶ËÇëÇ󣬴ËÇëÇó»á°üº¬À´×ÔGET/POSTÇëÇóµÄ²ÎÊý
¡¡¡¡response
ÍøÒ³´«»ØÓû§¶ËµÄ»ØÓ¦
¡¡¡¡pageContext
ÍøÒ³µÄÊôÐÔÊÇÔÚÕâÀï¹ÜÀí
¡¡¡¡session
ÓëÇëÇóÓйصĻỰÆÚ
¡¡¡¡application
servletÕýÔÚÖ´ÐеÄÄÚÈÝ
¡¡¡¡out
ÓÃÀ´´«ËÍ»ØÓ¦ ......

jsp ²É¼¯ С͵³ÌÐò

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.net.URL"%>
<%
URL url = new URL("http://www.itpub.net");//½¨Á¢URL¶ÔÏ󣬲¢ÊµÀý»¯Îªurl£¬»ñµÃҪץȡµÄÍøÒ³µØÖ·
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(),"GB2312")); ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ