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

·ÃÎÊJSPÎļþ»òÕßServletÎļþʱÌáʾ¡°ÏÂÔØ¡±

ÔÚ·ÃÎÊJSPÎļþ»òÕßServletµÄʱºò£¬Èç¹ûÌáʾÏÂÔز¢±£´æ£¬ÈçÏÂͼËùʾ£º
ͬÑùµÄ³ÌÐòÓеÄä¯ÀÀÆ÷³ö´í£¬ÓеÄä¯ÀÀÆ÷²»³ö´í¡£´íÎóµÄÔ­ÒòÊÇÉèÖÃMIMEÀàÐ͵ĴúÂëÓÐÎó¡£
Èç¹ûÊÇJSPÎļþ£¬²é¿´ÎļþÍ·£º
<%@ page contentType="text/html;charset=gb2312"%>
Èç¹ûÊÇServletÎļþ£¬²é¿´£º
response.setContentType("text/html;charset=gb2312");


Ïà¹ØÎĵµ£º

JSPÒ³ÃæÌøת´óÈ«

JSPÒ³ÃæÌøת´óÈ«
JSPÖеÄÌøת£º
(1). forward()·½·¨
    ʹÓõ½javax.servlet.RequestDispatcherÀà
    RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
    rd.forward(requestVar,requestVar); //´«µÝservletµÄÈë¿Ú²ÎÊý
   ......

jsp—MySqlÖÆ×÷B/sµÇ½µÄºÃÀý×Ó Ñ§Ï°±Ê¼Ç

½¨Á¢Ìõ¼þÊ×ÏÈÒ»¶¨ÒªÈ·¶¨×Ô¼ºµÄmysql£¬tomcat,eclipseÁ¬½ÓÊÇÕýÈ·µÄ¡£
index.jspºÜ¼òµ¥£¬¾ÍÒ»¸öÌøת¡£
<%
response.sendRedirect("lg.jsp");
%>
lg.jsp ʵÏֵǼ¿ò¼Ü
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>
login
</title>
</hea ......

JSPʵÀý¶þ¡¢µÇ¼ÑéÖ¤

·½·¨Ò»¡¢
login.html
<html>
  <head>
    <title>Óû§µÇ¼</title>
    <meta http-equiv="content-type" content="text/html; charset=gb2312">
  </head>
 
  <script language="javascript">
  &nbs ......

jsp¼¸ÖÖ·½·¨

1.±ØÐë¼Ì³Ð×ÔHttpServlet
  2.±ØÐëʵÏÖdoGet()»òÕßdoPost()
  3.±ØÐëÔÚweb.xmlÖÐÅäÖÃServlet
  <servlet>
  <servlet-name> </servlet-name>
  <servlet-class> </servlet-class>
  </servlet>
  <servlet-mapping>
  ......

JSPÒ³Ãæµ÷ÓÃjsÖÐÎÄÂÒÂë

jspÖеÚÒ»¾ä£º
<%@ page language="java" import="java.sql.*,java.util.*,"  contentType="text/HTML;charset=gb2312" pageEncoding="gb2312"%>
htmlÖмÓÉÏ
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
ͨ³£ÕâÑù¾ÍûÓÐÎÊÌâÁË¡£    .
ÔÙÕߣº µ¼ÈëjsʱºòÉ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ