java ÃæÊÔÌâ 2
Jsp
·½Ãæ
jspµÄ³£ÓõÄÃüÁî´ð£ºpage, include, talib, forward,
Servlet
·½Ãæ
1
¡¢ËµÒ»Ëµ
Servlet
µÄÉúÃüÖÜÆÚ
?
´ð:servletÓÐÁ¼ºÃ
µÄÉú´æÆڵĶ¨Ò壬°üÀ¨¼ÓÔغÍʵÀý»¯¡¢³õʼ»¯¡¢´¦ÀíÇëÇóÒÔ¼°·þÎñ½áÊø¡£Õâ¸öÉú´æÆÚÓÉjavax.servlet.Servlet½Ó¿ÚµÄ
init,serviceºÍdestroy·½·¨±í´ï¡£
2
¡¢
Servlet
°æ±¾¼ä
(
ÍüÁËÎʵÄÊÇÄÄÁ½¸ö°æ±¾ÁË
)
µÄ
²»Í¬
?
Ï£Íû´ó¼Ò²¹ÉÏ£¬Ð»Ð»
3
¡¢
JAVA SERVLET API
ÖÐ
forward()
Óë
redirect()
µÄ
Çø±ð£¿
´ð:Ç°Õß½öÊÇÈÝÆ÷ÖпØÖÆȨµÄתÏò£¬ÔÚ¿Í»§¶ËÀÀÆ÷µØÖ·À¸Öв»»áÏÔʾ³öתÏòºóµÄµØÖ·£»ºóÕßÔòÊÇÍêÈ«µÄÌøת£¬ä¯ÀÀÆ÷½«»áµÃ
µ½ÌøתµÄµØÖ·£¬²¢ÖØз¢ËÍÇëÇóÁ´½Ó¡£ÕâÑù£¬´Óä¯ÀÀÆ÷µÄµØÖ·À¸ÖпÉÒÔ¿´µ½ÌøתºóµÄÁ´½ÓµØÖ·¡£ËùÒÔ£¬Ç°Õ߸ü¼Ó¸ßЧ£¬ÔÚÇ°Õß¿ÉÒÔÂú×ãÐèҪʱ£¬¾¡Á¿Ê¹ÓÃ
forward()·½·¨£¬²¢ÇÒ£¬ÕâÑùÒ²ÓÐÖúÓÚÒþ²Øʵ¼ÊµÄÁ´½Ó¡£ÔÚÓÐЩÇé¿öÏ£¬±ÈÈ磬ÐèÒªÌøתµ½Ò»¸öÆäËü·þÎñÆ÷ÉϵÄ×ÊÔ´£¬Ôò±ØÐëʹÓÃ
sendRedirect()·½·¨¡£
4
¡¢
Servlet
µÄ»ù±¾¼Ü¹¹
public class
ServletName extends HttpServlet {
public void
doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
}
public void
doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
}
}
5
¡¢
ʲôÇé¿öϵ÷ÓÃ
doget()
ºÍ
ʲôÇé¿ö
dopost
´ð£ºµ±±íµ¥ÌύʱmethodÉèÖÃµÄ ÊÇ get ¾Íµ÷Óà doget ·½·¨£¬Èç¹ûÊÇ post ¾Íµ÷Óà dopost·½·¨¡£ http
get·½·¨ÇëÇóÒ»Ò³Ã棬µ÷ÓÃdoget() http post·½·¨ÇëÇóÒ»Ò³Ã棬µ÷ÓÃdopost()
6
¡¢
servlet
µÄ
init()
·½·¨ºÍ
service()
·½
·¨µÄÇø±ð
´ð£º³õʼ»¯Ê±µ÷ÓÃinit()·½·¨ÓÐÇëÇóµ½´ïʱµ÷ÓÃservice()·½·¨£¬service()¸ù¾ÝÇëÇóµÄÀàÐÍ£¬µ÷ÓÃdoget()»ò
depost()µÈ·½·¨
7
¡¢
servlet
µÄ
ÅäÖÃ
<web-app><servlet><servlet-name>Admin</servlet-name><servlet-class>jb-aptech.adminservlet</servlet-class><init-param><param-name>email</param-name><param-value>admin@jb-aptech.com.cn</param-value></init-param>
Ïà¹ØÎĵµ£º
½ñÌìѧϰÁËapplet²¼¾ÖÎÊÌ⣺
°´Å¥¡¢±êÇ©ÊÇÔõÑù¼ÓÈëµ½applet³ÌÐò(ÈÝÆ÷)µ±ÖÐÈ¥µÄÄØ£¿
ÐèÒªÓõ½²¼¾ÖÈÝÆ÷¹ÜÀíÆ÷(LayoutManager)£ºËüÓÃÓÚÐÖúÈÝÆ÷È·¶¨¼ÓÈëµÄ×é¼þ(°´Å¥µÈ)Ó¦¸Ã·ÅÖõÄλÖÃ
awtÌṩÁË4Öг£ÓõIJ¼¾ÖÈÝÆ÷¹ÜÀíÆ÷
>>FlowLayout
>>BorderLayout
>>GridLayout
>>CardLayout
appletĬÈÏÊ¹Ó ......
ÎÒÃÇΪʲôҪȥÃæÊÔ ? ÃæÊÔµÄÄ¿µÄÊÇʲô ?
ÃæÊÔÒª½â¾öÄļ¸¸öÎÊÌâ ?
Ò»¡¢ÃæÊÔµÄÄ¿µÄ
¶þ¡¢ÃæÊÔÇ°µÄ×¼±¸
Èý¡¢ÃæÊÔ³£¼ûÎÊÌâ½â´ð
A¡¢ÏîÄ¿¾Àí³£¼ûÎÊÌâ
B ......
ʹÓÃRuntime.getRuntime().exec()·½·¨¿ÉÒÔÔÚjava³ÌÐòÀïÔËÐÐÍⲿ³ÌÐò.
¸Ã·½·¨ÓÐ6¸ö¿É·ÃÎÊ°æ±¾:
1.exec(String command)
2.exec(String command, String envp[], File dir)
3.exec(String cmd, &n ......
ÔÚSUNÍƳö LWUIT¿ª·¢°ü֮ǰ£¬ÔÚJava MEƽ̨ÉÏ¿ª·¢Óû§½çÃæ²¢²»ÊÇÒ»¼þÈÝÒ×µÄÊ£¬ÓÈÆäÊÇÏë×ö³öºÜÑ£µÄ½çÃ棬¸üÊÇÄÑÉϼÓÄÑ£¬ÕâÊÇÒòΪÓÉMIDP±¾ÉíÌṩµÄÓû§½çÃæÔªËØ£¬°üjavax.microedition.lcdui
ÖÐÌṩµÄ×é¼þ¹¦ÄÜÏà¶Ô¼òµ¥¡£
ʹÓà LWUIT ¿ª·¢°ü£¬¿ª·¢ÈËÔ±²»ÔÙÐèÒª±àдÓëÉ豸ÆÁÄ»´óСÏà¹ØµÄ´úÂ룬Ëü²ÉÓÃÁËÓëSwing ÏàËƵĸÅÄîÌá ......
#include <iostream>
using namespace std;
class Base {
public:
virtual void fn(int x) {
cout << "In Base class, int x = " << x << endl;
}
};
class SubClass : public Base {
public:
// º¯ÊýµÄÖØÔØ,ÕâÑùµÄÖØÔØ·½Ê½,ÔÚJavaÖÐÄÜÐÐ,ÔÚC/C++ÖÐÈ´²»ÐÐ
virt ......