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

jsp ÂÒÂëÎÊÌâ

a.jspÒ³ÃæÄÚÈÝ£º
%26lt;%@ page language£½"java" import£½"java.util." pageEncoding£½"GB2312"%%26gt;%26lt;form action£½"b.jsp"%26gt; name£º%26lt;input type£½text name£½name%26gt; %26lt;input type£½submit%26gt;%26lt;/form%26gt;
b.jspÒ³ÃæÄÚÈÝ£º
%26lt;%@ page language£½"java" import£½"java.util." pageEncoding£½"GB2312"%%26gt;%26lt;% String name£½request.getParameter£¨"name"£©;%%26gt;%26lt;body%26gt; %26lt;%£½name%%26gt;%26lt;/body%26gt;
ÏÖÏó£ºÖÐÎÄÂÒÂ룬±ÈÈç“£¿£¿£¿£¿£¿£¿”
½â¾ö·½·¨ÈçÏ£º
·½·¨Ò»£º
1. ÔÚb.jspÖаÑpageEncoding£½"GB2312"¸ÄΪpageEncoding£½"ISO8859£­1"
ËäÈ»ÕâÑùb.jspÒ³ÃæÏÔʾµÄÄÚÈÝ»¹ÊÇÂÒÂ룬µ«ÊDz»ÊÇÄÇÖÖ“£¿£¿£¿£¿£¿£¿”µÄÂÒÂ룬¶øÊÇһЩÌØÊâ×Ö·û
2. È»ºóÔÚä¯ÀÀÆ÷Öв鿴²Ëµ¥ÖÐÐ޸ijÉGB2312µÄ±àÂ룬ÕâʱÂÒÂë¾ÍÏÔʾÖÐÎÄÁË¡£
3. µ«ÊÇÕâÖÖ·½·¨ÊDz»¿ÉÐеġ£
·½·¨¶þ£º
1. ÔÚb.jspÖаÑString name£½request.getParameter£¨"name"£©;ÐÞ¸ÄΪ
String name£½new String£¨request.getParameter£¨"name"£©.getBytes£¨"ISO£­8859£­1"£©£¬"GB2312"£©;
2. ÕâʱÔÙÔÚÒ³ÃæÉÏÏÔʾ£¬Ôò¾ÍÊÇÖÐÎÄÁË¡£
·½·¨Èý£º
1. ÓÐÈË˵ÐÞ¸Äget/postµÄ´«Öµ·½Ê½£¬µ«ÊÇÕâÊÇÓÐÇ°ÌáµÄ£¬Èç¹ûÖ»ÊÇ°Ñget·½Ê½Ð޸ijÉpost·½Ê½£¬Ò³Ãæ½á¹û»¹ÊÇÂÒÂ룡
2. Ç°ÌáÄã±ØÐëÅäÖÃÁ˹ýÂËÆ÷£¬Èô¹ûÄãÖ»ÊÇÅäÖÃÁ˹ýÂËÆ÷£¬Ôò´«Öµ·½Ê½±ØÐëÊÇ£ºpost·½Ê½²Å²»ÊÇÂÒÂ룬Èç¹ûÊÇget·½Ê½ÕÕÑùÊÇÂÒÂ룡
3. ¹ýÂËÆ÷µÄÅäÖã¬ÎÒÏë´ó¼Ò¶¼ÄÜÓУ¬ÎҾͲ»ËµÁË
·½·¨ËÄ£º
1. ÓÐÈË˵ÅäÖÃtomcatµÄÅäÖÃÎļþserver.xmlÀïÕâ¾ä£º
%26lt;Connector URIEncoding£½"GB2312" port£½"8080" maxHttpHeaderSize£½"8192" maxThreads£½"150" minSpareThreads£½"25" maxSpareThreads£½"75" enableLookups£½"false" redirectPort£½"8443" acceptCount£½"100" connectionTimeout£½"20000" disableUploadTimeout£½"true" /%26gt;
¼ÓÉÏÕâ¾ä£ºURIEncoding£½"GB2312"
2. ËäÈ»¿ÉÒÔµ«ÊÇÓÐÇ°ÌáµÄ£¬Èô¹ûÄã¹ýÂËÆ÷ûÓÐÅäÖã¬ÔòÖ»ÊÇÅäÖÃÁËserver.xmlÎļþ£¬ÕâÑùÖ»ÓÐÔÚ±íµ¥ÊÇget´«ÖµÊ±ºò²Å¿ÉÒÔ£¡µ±ÊÇpost·½Ê½Ê±£¬ÕÕÑùÊÇÂÒÂ룡
ÕâʱÎÒÃǾͿÉÒÔ¿´³öÔÚtomcat5ÖеÄpostÓëget´«Öµ·½Ê½ÊDz»Ò»ÑùµÄ
ÓÐÈËÒªÎÊÓÐûÓÐÒ»ÖÖ·½·¨Èô«ÖµÊ¹ÓÃget·½Ê½»òpost·½Ê½¶¼ºÃÓÃÄØ£¬ÏÂÃæ¾ÍÊÇÎÒÍƼöµÄ·½·¨Îå
·½·¨Î壺
1. ÆäʵºÜ¼òµ¥£¬¾ÍÊÇͬʱʵÏÖ·½·¨ÈýÓÖʵÏÖ·½·¨ËÄ£¡
2. ¾ÍÊÇÏ


Ïà¹ØÎĵµ£º

JSP½ûÖ¹»º´æ´úÂë

 //JSP½ûÖ¹»º´æ´úÂë

response.setHeader("Pragma","No-cache");

response.setHeader("Cache-Control","no-cache");

response.setDateHeader("Expires", 0);



//ÍøÂçÉϵIJ»ÄÜÕýÈ·ÔËÐдúÂë²Î¿¼

if(request.getProtocol().compareTo("HTTP/1.0")==0)

{
......

windowsÏÂÅäÖÃJSP¿ª·¢»·¾³

 Ò»¡¢°²×°JDK
¡¡¡¡Ê×ÏÈÏÂÔØJDK 5.0£¨JDK 5.0µÄÏÂÔØÒ³ÃæΪ£ºhttp://java.sun.com/j2se/1.5.0/download.jsp£©£» È»ºóÔËÐÐJDK 5.0°²×°³ÌÐòjdk-1_5_0_06-windows-i586-p.exe£¬°²×°¹ý³ÌÖÐËùÓÐÑ¡Ïî±£³ÖĬÈÏ£»×îºóÅäÖÃJDKµÄ»·¾³±äÁ¿£ºÔÚ“ÎҵĵçÄÔ”ÉϵãÓÒ¼ü—>“ÊôÐÔ”—>“¸ß¼¶& ......

JSPÖеÄÏà¶Ô·¾¶½â»ó

¼òµ¥Ê¾Àý
JSPÒ³ÃæÖУ¬ÎÒÃǾ­³£ÓÐÒýÓø÷ÖÖͼƬµÈ×ÊÔ´£¬ÀýÈçÏÂÃæµÄjspƬ¶ÎÖÐ
<div class="main">
      <a href="http://www.sina.com.cn/abc.htm">
              <strong>Îҵĵµ°¸</strong>
&nbs ......

JSP²ÊÉ«ÑéÖ¤Âë

²úÉúÑéÖ¤ÂëͼƬµÄÎļþ-----image.jsp
<%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*" %>
<%!
Color getRandColor(int fc,int bc){//¸ø¶¨·¶Î§»ñµÃËæ»úÑÕÉ«
        Random random = new Random();
  &nb ......

Java/JspÅäÖÃ

JAVAÅäÖãº
1£º JAVA_HOME £º  C:\Program Files\Java\jdk1.6.0_12
2£ºCLASSPATH £º    .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
3£ºPATH £º              %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
TomcatÅäÖ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ