ÎÒµÄjsp - Java / Web ¿ª·¢
ÎÒ¸Õ¸Õѧµ½javabean ÕâÀï ½ñÌìÕÕ×ÅÊéдÁËÒ»¸ö µ«ÊÇÔõô¶¼ÔËÐв»ÁË ÎÒ µÄ classÎļþ´æ·ÅµÄ·¾¶ÊÇÕâÑùµÄ
F:\tomcat\Tomcat 6.0\webapps\ROOT\WEB-INF\classes\tom
¡¶ËµÃ÷Õâ¸ö¡·
Õâ¸öjavaÎļþµÄ´úÂëÊÇÕâÑùµÄ
Java code:
package tom;
import java.io.*;
public class Circle
{
int radius;
public Circle()
{
radius=1;
}
public int getRadius()
{
return radius;
}
public void setradius(int n)
{
radius=n;
}
public double circleArea()
{
return Math.PI*radius*radius;
}
public double circlelength()
{
return Math.PI*2*radius;
}
}
Õâ¸öjavaÎļþÊÇ·ÅÔÚF:\tomcat\Tomcat 6.0\webapps\ROOT\WEB-INF\classesÖеÄ
È»ºóÎÒµÄjspÎļþÊÇ·ÅÔÚF:\tomcat\Tomcat 6.0\webapps\ROOT\MyJspÕâ¸öÖÐµÄ È»ºóµ÷ÓÃÔõô¶¼ÕÒ²»µ½Õâ¸öclassÎļþ ÊÇʲôÎÊÌâѽ ´ó¼Ò°ïÎÒ·ÖÎö·ÖÎö ÎÒ¿ì±ÀÀ£ÁË ¾´Àñ
HTML code:
<%@page contentType="text/html;charset=GBK"%>
<%@page import="tom.jiafei.Circle"%>
<html><body bgcolor=cyan><font size=3>
<jsp:useBean id="circle" class="tom.Circle" scope="page"/>
<%
circle.setradius(8
Ïà¹ØÎÊ´ð£º
JSPÒ³ÃæÖÐÓжà¸öradio°´Å¥
JSPÒ³Ã潫²ÎÊýPOST¸øservlet
ÒªÇóÈçÏÂ;
1.Ñ¡ÔñÒ»¸öradio£¬µ÷ÓÃservlet servletÖиù¾Ý²ÎÊýµ÷ÓÃÆäËû½Ó¿Ú£¬³ý·ÇÑ¡ÖиÃradio²¢µã»÷JSPÖеÄʵР......
insert into [ScholarshipManagement].[dbo].[department] ([department],[specialization] ,[grade]) output inserted.departmentID values(? ,? ,? )
ÇëÎÊ´ó¸çÃÇÕâ¸ösql Óï¾äÓ¦¸ÃÓÃJavaÀïµÄÄǸöÊý¾Ý¿â²Ù×÷·½·¨£¿ ......
ÔھƵê¹ÜÀíϵͳÖÐ,ÓÐÒ»¸ö¶ÔÄÚµÄϵͳ,¹©Ç°Ì¨·þÎñÔ±ºÍ¾ÀíʹÓÃ
»¹ÓÐÒ»¸ö¾ÍÊǶÔÍâ,Èÿͻ§¿ÉÒÔÔÚÍøÉÏÔ¤¶©·¿¼ä,
ËüÃÇÖ®¼äÊÇÔõôͨѶµÄ.?µ±ÎÒÌá½»Ô¤¶©·¿¼äÐÅÏ¢µÄʱºò,
ÔÚ¶ÔÄÚµÄϵͳÖÐ,ÈçºÎÖªµÀÎÒÒѾÌá½»ÁËÐÅÏ¢¹ýÈ¥.Ê¹Ç ......
ÎÒдÁ˸öjspÒ³Ã棬Ȼºó¸Ä¶¯ÁËһϣ¬¸Ä¶¯µÄÄÚÈݾÍÊÇÔÚjspÒ³ÃæµÄjsº¯ÊýÀï¼ÓÁ˸öalert()Óï¾ä£¬µ«ÊÇÎÒ·ÃÎÊÕâ¸öÒ³Ãæʱ£¬ËÀ»î¶¼ÊÇÔÀ´Ò³ÃæµÄÄÚÈÝ£¬ÎÒ¼ÓÁ˺ܶàalertº¯Êý»¹ÊÇû¸Ä¶¯Ç°µÄÒ³ÃæÄÚÈÝ£»tomcatÖØÆôÁË£¬Ò²ÖØв¿ÊðÕâ ......