Java?????JSP???
???????????? ???????[ 2016/8/16 10:38:51 ] ??????????????????? Java
???????Java Bean????
????1.??????
????Java Bean??????????Java Bean?????????????useBean?????setProperty?????getProperty??????Java Bean???????Java??Java Bean????????????????????????getter??????setter???????????????boolean???????????????????getter????д??isXxx()????????getXxx()??
????2.???????
????scope???????????
????Counter.java
1 package com.bean;
2
3 public class Counter {
4
5 private int count; //??????
6
7 public int getCount(){ //???????Σ??????????1
8 return ++count;
9 }
10 public void setCount(int count){
11 this.count = count;
12 }
13 }
????Counter.jsp
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 <%
3 String path = request.getContextPath();
4 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5 %>
6
7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8 <html>
9 <head>
10 <base href="<%=basePath%>">
11
12 <title>My JSP 'Counter.jsp' starting page</title>
13
14 <meta http-equiv="pragma" content="no-cache">
15 <meta http-equiv="cache-control" content="no-cache">
16 <meta http-equiv="expires" content="0">
17 <meta http-equiv="keywords" content="keyword1??keyword2??keyword3">
18 <meta http-equiv="description" content="This is my page">
19 <!--
20 <link rel="stylesheet" type="text/css" href="styles.css">
21 -->
22
23 </head>
24
25 <body>
26 <!-- ???????session??Χ??????????????????????? -->
27 <jsp:useBean id="personCount" class="com.bean.Counter" scope="session" />
28 <!-- ???????application??Χ?????????????????????????? -->
29 <jsp:useBean id="totalCount" class="com.bean.Counter" scope="application" />
30 <div align="center">
31 <form action="page/Counter.jsp" method="get">
32 <fieldset style="width:300">
33 <legend>??????</legend>
34 <table align="center" width="400">
35 <tr>
36 <td>????????????
37 </td>
38 <td>
39 <!-- ?????????????? -->
40 <jsp:getProperty property="count" name="personCount"/>
41 </td>
42 </tr>
43 <tr>
44 <td>?????????????
45 </td>
46 <td>
47 <!-- ???????????????? -->
48 <jsp:getProperty property="count" name="totalCount"/>
49 </td>
50 </tr>
51 <tr>
52 <td colspan="2">
53 <input type="submit" value="???">
54 </td>
55 </tr>
56 </table>
57 </fieldset>
58 </form>
59 </div>
60 </body>
61 </html>
????3.Ч?????
????????<jsp:plugin/>???Applet
????1.??????
????Java Applet????????????????????JavaС????JSP???????plugin????????Applet???????plugin???????<jsp:plugin/><jsp:params/><jsp:param/><jsp:fallback/>??????<jsp:plugin/>??????JSP?ж???Java Applet????????Applet?????????????<jsp:params/>????????????????????<jsp:param/>??????嵥?????????<jsp:fallback/>??????岻???Applet???????????
????2.???????
????Plugin.jsp
1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 <%
3 String path = request.getContextPath();
4 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5 %>
6
7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8 <html>
9 <head>
10 <base href="<%=basePath%>">
11
12 <title>My JSP 'Plugin.jsp' starting page</title>
13
14 <meta http-equiv="pragma" content="no-cache">
15 <meta http-equiv="cache-control" content="no-cache">
16 <meta http-equiv="expires" content="0">
17 <meta http-equiv="keywords" content="keyword1??keyword2??keyword3">
18 <meta http-equiv="description" content="This is my page">
19 <!--
20 <link rel="stylesheet" type="text/css" href="styles.css">
21 -->
22
23 </head>
24
25 <body>
26 <table align="center" bgcolor="#999999" cellpadding="1">
27 <tr>
28 <td bgcolor="#FFFFFF">
29 <jsp:plugin
30 code="Graph.class"
31 codebase="http://java.sun.com/applets/jdk/1.4/demo/applets/GraphLayout/"
32 type="applet" width="500" height="400">
33 <jsp:params>
34 <jsp:param value="joe-food??joe-dog??joe-tea??table-plate/50"
35 name="edges"/>
36 </jsp:params>
37 <jsp:fallback>??????????????Java Applet</jsp:fallback>
38 </jsp:plugin>
39
40 </td>
41 </tr>
42 </table>
43 </body>
44 </html>
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11