С±à¸ÅÊöJSP¼¼Êõ
°´Õսű¾ÓïÑÔÊÇ·þÎñÓÚijһ¸ö×ÓϵͳµÄÓïÑÔÕâÖÖÂÛÊö£¬ JSPÓ¦µ±±»¿´×÷ÊÇÒ»Öֽű¾ÓïÑÔ£¬È»¶ø£¬×÷ΪһÖֽű¾ÓïÑÔ£¬ JSPÓÖÏԵùýÓÚÇ¿´óÁË£¬ÔÚJSPÖм¸ºõ¿ÉÒÔʹÓÃÈ«²¿µÄJavaÀà¡£
×÷ΪһÖÖ»ùÓÚÎı¾µÄ¡¢ÒÔÏÔʾΪÖÐÐĵĿª·¢¼¼Êõ£¬JSPÌṩÁËJava Servlet µÄËùÓкô¦£¬²¢ÇÒ£¬µ±ÓëÒ»¸öJavaBeans Àà½áºÏÔÚÒ»Æðʱ£¬ÌṩÁËÒ»ÖÖʹÄÚÈݺÍÏÔʾÂß¼·Ö¿ªµÄ¼òµ¥·½Ê½¡£·Ö¿ªÄÚÈݺÍÏÔʾÂß¼µÄºÃ´¦ÊÇ£¬¸üÐÂÒ³ÃæÍâ¹ÛµÄÈËÔ±²»±Ø¶®µÃJava ´úÂ룬¶ø¸üÐÂJava BeansÀàµÄÈËÔ±Ò²²»±ØÊÇÉè¼ÆÍøÒ³µÄÐмÒÀïÊÖ£¬¾Í¿ÉÒÔÓôøJavaBeans ÀàµÄJSP Ò³ÃæÀ´¶¨ÒåWeb Ä£°å£¬ÒÔ½¨Á¢Ò»¸öÓɾßÓÐÏàËƵÄÍâ¹ÛµÄÒ³Ãæ×é³ÉµÄÍøÕ¾¡£JavaBeans ÀàÍê³ÉÊý¾ÝÌṩ£¬ÕâÑùÔÚÄ£°åÖоÍûÓÐJava ´úÂ룬ÕâÒâζ×ÅÕâЩģ°å¿ÉÒÔÓÉÒ»¸öHTML ±àдÈËÔ±À´Î¬»¤¡£µ±È»£¬Ò²¿ÉÒÔÀûÓÃJava ServletÀ´¿ØÖÆÍøÕ¾µÄÂß¼£¬Í¨¹ýJava Servletµ÷ÓÃJSPÎļþµÄ·½Ê½À´½«ÍøÕ¾µÄÂß¼ºÍÄÚÈÝ·ÖÀë¡£±¾ÕÂÎÒÃǺóÃ潫¶ÔÕâÖÖ·ÖÀëÍøÕ¾µÄÂß¼ºÍÄÚÈݵÄÉè¼Æ·½·¨×öһЩ¸üÉîÈëµÄÃèÊö¡£
ÔÚÑ¡ÔñʹÓÃÒ»¸öJava Servlet£¬»¹ÊÇÒ»¸öJSPÒ³Ãæʱ£¬Òª¼ÇסµÄÊÇ£¬Java Servlet ÊÇÒ»¸ö³ÌÐòÉè¼Æ¹¤¾ß£¬Ëü×îÊÊÓÃÓÚ²»ÐèҪƵ·±Ð޸ĵĵͼ¶Ó¦Óù¦ÄÜ; ¶øJSPÒ³ÃæÔòͨ¹ýÒÔÏÔʾΪÖÐÐĵÄÃèÊöÐԵķ½·¨½«¶¯Ì¬ÄÚÈݺÍÂß¼½áºÏÔÚÒ»Æ𡣶ÔÓÚʹÓÃÒ»¸öJSP Ò³ÃæµÄ¼òµ¥µÄ»ùÓÚWeb µÄÓ¦ÓóÌÐò£¬¿ÉÒÔʹÓö¨ÖƱê¼Ç»òÕßScriptlet£¬¶ø²»ÊÇʹÓÃJavaBeans ÀàÀ´½«ÄÚÈÝÓëÓ¦ÓÃÂß¼½áºÏÆðÀ´¡£¶¨ÖƱê¼Ç±»´ò°üµ½Ò»¸ö±ê¼Ç¿âÖУ¬²¢±»ÒýÈëµ½Ò»¸öJSP Ò³ÃæÖС£Scrip tletÊÇÖ±½ÓǶÈëÔÚJSP Ò³ÃæÖеĺÜСµÄJava´úÂë¶Î¡£
Ò»°ãÀ´Ëµ£¬ÔÚʵ¼ÊµÄJSPÒýÇæÖУ¬ JSPÒ³ÃæÔÚÖ´ÐÐʱÊDZàÒëʽ£¬¶ø²»ÊǽâÊÍʽµÄ¡£½âÊÍʽµÄ¶¯Ì¬ÍøÒ³¿ª·¢¹¤¾ßÈçASP¡¢PHP3µÈÓÉÓÚËٶȵÈÔÒòÒѾÂú×ã²»Á˵±Ç°´óÐ͵ç×ÓÉÌÎñÓ¦ÓõÄÐèÒªÁË£¬´«Í³µÄ¿ª·¢¼¼Êõ¶¼ÔÚÏò±àÒëÖ´Ðеķ½Ê½¸Ä±ä£¬ÈçASP→ASP +£»PHP3→PH P 4¡£¶ø¾¡¹ÜJSPµÄ¹æ·¶ÊéÖв¢Ã»ÓÐÒªÇóʵ¼ÊµÄJSPÒýÇæҪʹÓñàÒëʽµÄÖ´Ðз½Ê½£¬µ«¹À¼ÆÒ»°ãÊDz»»áʹÓýâÊ͵ķ½Ê½À´Ö´ÐÐJSPÒ³ÃæµÄ¡£Í¨³£ËµÀ´£¬ JSPÒ³ÃæÒ»°ãÊÇ·ÒëΪServletµÄJavaÔ´Îļþ£¬ÔÙ¾¹ýJava±àÒëÆ÷
±àÒëΪServletµÄc l a s sÎļþ¡£ÎªÊ²Ã´Òª±àÒëΪServletÄØ£¿¾Ý˵ÊÇΪÁËÈÃÔÏȵÄServletÒýÇæ¿ÉÒÔÖ±½Ó·þÎñÓÚJSP£¬¶øJSPÒýÇæ¾Í½ö½öÐèÒª½«JSPתÒëΪServlet¾Í¿ÉÒÔÁË¡£ÕâÀïҪעÒâµÄÊÇ£º JSP¹æ·¶ÊéÖв¢Ã»Óй涨ÈçºÎ½«JSPÒ³ÃæתÒëΪServlet£¬Òò´Ë£¬²»Í¬µÄJSPÒýÇæתÒëµÄ½á¹ûÒ²ÊDz»Ò»ÑùµÄ¡£ÔÚJSPÎļþתÒëΪServletÒÔºó£¬Ã¿´Î¿Í»§»ú£¨Í¨³£ÊÇÓû§µÄWe bä¯ÀÀÆ÷£©
Ïà¹ØÎĵµ£º
½â¾ö°ì·¨£º
µÚÒ»£º
1:ÔÚjspÒ³Ãæ¼ÓÈ룺
<%@ page contentType="text/html; charset=gb2312" %>
2:ÔÚservletÀïÃæ:
public void doGet(HttpServletRequest request, HttpServletResponse &nbs ......
package servlet;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloBeijing extends HttpServlet{
//public void init(ServletConfig config) throws ServletException{
// super.init(config);
//}
public void service(HttpServletRequest request,HttpServlet ......
1ÔõÑù¸Ä±ämyeclipseĬÈϵÄjsp ´ò¿ª·½Ê½
preferences->General->editors£>Files Associations£¨Î»Öøù¾Ý¾ßÌåeclipse°æ±¾»áÓÐËù²»Í¬£© File Types Ñ¡Ôñ.jsp assiciations ÀïÑ¡ÔñMyEclipse jsp editor£¬È»ºóµãÓұߵÄdefault
2,ÉèÖÃMyEclipse ×ÖÌå´óС
ÔÚwindow->perferences->General->Appearance-> ......
Ê×ÏÈ£¬ËµËµJSP/ServletÖеļ¸¸ö±àÂëµÄ×÷Óá£
ÔÚJSP/ServletÖÐÖ÷ÒªÓÐÒÔϼ¸¸öµØ·½¿ÉÒÔÉèÖñàÂ룬pageEncoding="UTF-8"¡¢contentType="text/html;charset=UTF-8"¡¢request.setCharacterEncoding("UTF-8")ºÍresponse.setCharacterEncoding("UTF-8")£¬ÆäÖÐÇ°Á½¸öÖ»ÄÜÓÃÓÚJSPÖУ¬¶øºóÁ½¸ö¿ÉÒÔÓÃÓÚJSPºÍServletÖС£
1¡ ......