Oreilly upload source components
Abstract: Oreilly upload source components
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> upload open source components. Function TempSave (ElementID) (CommentsPersistDiv.setAttribute ( "CommentContent" document.getElementById (ElementID). Value); CommentsPersistDiv.save ( "CommentXMLStore");) function Restore (ElementID) (CommentsPersistDiv.load ( "CommentXMLStore"); document . getElementById (ElementID). CommentsPersistDiv.getAttribute value = ( "CommentContent");) </ td> </ tr> <tr>
↑ Back
Chinese Version jdom2.5 source jive
Abstract: Chinese Version jdom2.5 source jive
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> learning jsp Forum production and design patterns classical source. </ Td> </ tr> <tr>
↑ Back
Jsp + + servlet javaBean achieve MVC
Abstract: jsp + + servlet javaBean achieve MVC
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="272" height="86" align="center" valign="top"> </ td> <td width="412" valign="top"> note
One source
Jsp + + servlet javaBean achieve MVC
If the recommendations can contact me QQ
If any company can be contacted urgently needed talent I J2EE (limit Beijing)
My Email: 27612285@qq.com
My Tel :010-81110277 (Mr. Wang)
I mastering existing J2EE technology!
Date: the last week of 2005
</ Td> </ tr> <tr> <td height="20" colspan="2">
</ Td> </ tr> </ table>
Graph 1
Graph 2
</ Td> </ tr> <tr>
↑ Back
Jsp entry examples - multimedia classrooms single booking
Abstract: jsp entry examples - multimedia classrooms single booking
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle">
This article will demonstrate how you use Apache Tomcat JSP + to create multimedia classrooms appointment alone.
1, interface requirements:
The first week alone multimedia classrooms appointment
I would like to booking <table width = "56%" border = 1> <tr> <td width="12%"> </ td> <td width="12%"> Monday </ td> <td width = "12%"> Tuesday </ td> <td width="12%"> Wednesday </ td> <td width="12%"> Thursday </ td> <td width="13%"> Friday </ td> <td width="13%"> Saturday </ td> <td width="14%"> Sunday </ td> </ tr> <tr> <td> the first quarter </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td > </ tr> <tr> <td> section </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> < / td> <td> </ td> <td> </ td> </ tr> <tr> <td> the third quarter </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> </ tr> <tr> <td> IV </ td> < td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> </ tr> <tr> <td> Section V </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> </ tr> <tr> <td> VI </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> </ tr> <tr> <td> Section VII </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> </ tr> <tr> <td> VIII </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td> </ td> <td > </ td> <td> </ td> </ tr> </ table>
Among them, "I would like to reserve" hyperlinks to fill booking single page.
Second, install Tomcat
Tomcat installed first, and then we set up the working directory.
First, in the c: \ Tomcat 5.0 \ webapps directory to create a subdirectory called yyd. Then yyd subdirectory,
Creating standards for Web application directory structure:
C: \ Tomcat 5.0 \ webapps \ yyd
C: \ Tomcat 5.0 \ webapps \ yyd \ WEB-INF
C: \ Tomcat 5.0 \ webapps \ yyd \ WEB-INF \ classes
C: \ Tomcat 5.0 \ webapps \ yyd \ WEB-INF \ classes \ dingdan
Third, we set up the appointment database single database for storing records of the appointment of teachers, open Access, to create the database dingdan, archiving kept in:
C: \ Tomcat 5.0 \ webapps \ yyd \ WEB-INF \ dingdan.mdb
In creating 25 Table: guestbook1, guestbook2 … guestbook25. Like the structure of each table, as follows:
Field Description </ td> <td> field </ td> <td> data types </ td> <td> whether empty </ td> </ tr> <tr> <td> # </ td > <td> serial_no </ td> <td> automatically # </ td> <td> not </ td> </ tr> <tr> <td> name </ td> <td> name </ td> < td> text </ td> <td> not </ td> </ tr> <tr> <td> several weeks </ td> <td> week </ td> <td> text </ td> <td> not </ td> </ tr> <tr> <td> first sections of </ td> <td> jie </ td> <td> text </ td> <td> not </ td> </ tr> <tr> <td> class topics </ td> <td> content </ td> <td> text </ td> <td> not </ td> </ tr> </ table>
We use 25 tables corresponding one semester of 25 weeks, so manageable. Of course, it could also be a table. Week and jie field with the text type.
Fourth, set up data sources
To win2000 example, from the control panel to open the management tools "ODBC data source management," and click "System DSN" tab, in which data sources dingdan added, pointing us in the creation of a database dingdan.mdb above.
5, multimedia classrooms appointment single file structure
Making use of this appointment will be five single document:
Dingdan.jsp choose week, the main document.
Index1.jsp appointment this week showed that the document jsp
Adddingdan.jsp fill the appointments for teachers alone
Okdingdan.jsp appointment will be recorded into the database
Dingdan.java for connecting to database
(1) Dingdan.jsp booking option is for teachers of the week, jsp documents, and is responsible for the index1.jsp transmission parameters. The original code is as follows:
<% @ Page contentType = "text / html; gb2312 charset ="%>
<body>
Multimedia classrooms appointment alone
<table Border="0" width="103%" cellspacing="0" cellpadding="0" height="1">
<tr> <form Name="guideform" action=index1.jsp target="_blank" method="post">
<select Name="guidelinks">
<option SELECTED value="1"> first week
<option Value="2"> second week
<option Value="3"> third week
<option Value="4"> fourth week
<option Value="5"> fifth week
<option Value="6"> sixth week
<option Value="7"> seventh week
<option Value="8"> 8 weeks
<option Value="9"> ninth week
<option Value="10"> 10th week
<option Value="11"> Week 11
<option Value="12"> 12 weeks
<option Value="13"> 13 weeks
<option Value="14"> 14th week
<option Value="15"> 15th week
<option Value="16"> 16th week
<option Value="17"> 17 weeks
<option Value="18"> 18th week
<option Value="19"> 19 weeks
<option Value="20"> 20th week
<option Value="21"> 21 weeks
<option Value="22"> 22 weeks
<option Value="23"> 23 weeks
<option Value="24"> 24 weeks
<option Value="25"> 25th week
</ Select> <input type = "submit" name = "go" value = "Go!"
</form>
</ Tr>
</ Table>
</ Body>
(2) to show that this week's index1.jsp booking situation
Week booking situation with an array week [] [] record, first of all, the array will be given initial:
For (int i = 0; i <= 8; i + +)
For (int j = 0; j <= 7; j + +)
Week [i] [j] = "";
Week [0] [1] = "Monday";
Week [0] [2] = "Tuesday";
Week [0] [3] = "Wednesday";
Week [0] [4] = "Thursday";
Week [0] [5] = "Friday";
Week [0] [6] = "Saturday";
Week [0] [7] = "Sunday";
For (int i = 1; i <= 8; i + +)
Week [i] [0] = "" + i + "Festival";
This array of other elements of value from the database to read out
Rs = showBean.executeQuery ( "SELECT * FROM guestbook" + sn1);
While (Rs.next ()) (
E1 = Rs.getString (the "week");
Name1 = Rs.getString ( "name");
E2 = Rs.getString ( "jie");
Int k = Integer.parseInt (e1);
Int l = Integer.parseInt (e2);
Week [l] [k] = name1;
)
Finally, a week shown in the table [] []. The original code is as follows:
<% @ Page contentType = "text / html; gb2312 charset ="%>
<head>
<script LANGUAGE="javascript">
Function newwin (url) (
Var newwin = window.open (url, "newwin", "toolbar = no, location = no, directories = no,
Status = no, menubar = no, scrollbars = yes, resizable = yes, width = 400, height = 350 ");
Newwin.focus ();
Return false;
)
</ Script>
</ Head>
<body Bgcolor="#FFFFCC">
<script LANGUAGE="javascript">
Function submit11 ()
(
Self.location.replace ( "index1.jsp")
)
</ Script>
<%
String sn, sn1;
String e1;
String name1;
String e2;
String week [][]= new String [9] [8];
Int m1 and m2;
Sn = request.getParameter ( "guidelinks");
If (sn! = Null) (
Session.setAttribute ( "SN" sn);
Sn1 = (String) session.getAttribute ( "SN");
Else ()
Sn1 = (String) session.getAttribute ( "SN");)
%>
No. <%% sn1 => weeks multimedia classrooms single booking
<% @ Page language = "java" import = "java.sql .*"%>
<%
ResultSet Rs = null;
For (int i = 0; i <= 8; i + +)
For (int j = 0; j <= 7; j + +)
Week [i] [j] = "";
Week [0] [1] = "Monday";
Week [0] [2] = "Tuesday";
Week [0] [3] = "Wednesday";
Week [0] [4] = "Thursday";
Week [0] [5] = "Friday";
Week [0] [6] = "Saturday";
Week [0] [7] = "Sunday";
For (int i = 1; i <= 8; i + +)
Week [i] [0] = "" + i + "Festival";
Try (
Rs = showBean.executeQuery ( "SELECT * FROM guestbook" + sn1);
While (Rs.next ()) (
E1 = Rs.getString (the "week");
Name1 = Rs.getString ( "name");
E2 = Rs.getString ( "jie");
Int k = Integer.parseInt (e1);
Int l = Integer.parseInt (e2);
Week [l] [k] = name1;
)
Rs.close ();
) Catch (Exception e) (
System.out.println (e.toString ());
)
ShowBean.closeConn ();
%>
<% Out.print ( "I want to reserve");%>
<table Border='1' cellspacing='0' width='632' bgcolor='#ffffff bordercolorlight='red' bordercolordark='red'>
<% For (m1 = 0; m1 <= 8; m1 + +) (%>
<tr>
<% For (m2 = 0; m2 <= 7; m2 + +) (%>
<td Bgcolor='#33ccff'> <% = week [m1] [m2]%> </ td>
<%)%>
<tr>
<%)%>
</ Table>
Certain production
(3) add.jsp to fill appointments for teachers to single ok_add.jsp transfer form data.
The original code below, the function valiform () client for the certification form.
<% @ Page contentType = "text / html; gb2312 charset ="%>
<head>
<script LANGUAGE="JavaScript">
Function valiform () (
If (document.form1.content.value ==""){
Alert ( "Please type the subject!");
Document.form1.content.focus ();
Return false;
)
Else if (document.form1.name.value ==""){
Alert ( "Please enter names!");
Document.form1.name.focus ();
Return false;
)
Else if (document.form1.week.value ==""){
Alert ( "Please enter weeks!");
Document.form1.week.focus ();
Return false;
)
Else if (document.form1.jie.value ==""){
Alert ( "Please enter the festival!");
Document.form1.jie.focus ();
Return false;
)
)
</ Script>
</ Head>
<body>
<form METHOD=POST action="ok_add.jsp" name=form1 onSubmit="return valiform()">
Single-booking
Reservation alone can not be changed, please carefully fill!
<table Width='60%' height='120'>
<tr>
<td> Name: <input TYPE = "text" name = "name" value = ""> </ td>
</ Tr>
<tr>
<td> Week:
<select Name="week" size="1">
<option Style="color: #000000" value="1" selected> Monday </ option>
<option Style="color: #000000" value="2"> Tuesday </ option>
<option Style="color: #000000" value="3"> Wednesday </ option>
<option Style="color: #000000" value="4"> Thursday </ option>
<option Style="color: #000000" value="5"> Friday </ option>
<option Style="color: #000000" value="6"> Saturday </ option>
<option Style="color: #000000" value="7"> Sunday </ option>
</ Select>
</ Td>
<tr>
<td> Sections: <select name = "jie" size = "1">
<option Style="color: #000000" value="1" selected> the first quarter </ option>
<option Style="color: #000000" value="2"> section </ option>
<option Style="color: #000000" value="3"> the third quarter </ option>
<option Style="color: #000000" value="4"> IV </ option>
<option Style="color: #000000" value="5"> Section V </ option>
<option Style="color: #000000" value="6"> VI </ option>
<option Style="color: #000000" value="7"> Section VII </ option>
<option Style="color: #000000" value="8"> VIII </ option>
</ Select>
</ Td>
</ Td>
</ Tr>
<tr>
<td> Topics: <input type "text" name = "content" value =""></ td>
</ Tr>
<tr>
<td Align="center"> <input TYPE="submit" size="4" value="æäº¤" class="buttonface">
<input TYPE="reset" size="4" value="é‡å†™" class="buttonface"> </ td>
</ Tr>
</ Table>
</ Form>
</ Body>
(4) ok_add.jsp documents will be teachers appointment data into the database and refresh index1.jsp
<head>
<% @ Page contentType = "text / html; gb2312 charset ="%>
</ Head>
<% @ Page language = "java" import = "java.sql .*"%>
<%
Int i = 0;
String name = new String (request.getParameter ( "name"). GetBytes ( "8859_1"));
String em = new String (request.getParameter ( "week"). GetBytes ( "8859_1"));
String em2 = new String (request.getParameter ( "jie"). GetBytes ( "8859_1"));
String content = new String (request.getParameter ( "content"). GetBytes ( "8859_1"));
String sn = (String) session.getAttribute ( "SN");
String sql = "select * from guestbook" + sn;
ResultSet rs = addBean.executeQuery (sql);
While (rs.next ()) (
String ee = rs.getString (the "week");
String ee1 = rs.getString ( "jie");
If ((em.equals (ee ))&&( em2.equals (ee1))) (
I = 1;
Break;
)
)
Rs.close ();
If (i == 0) (
String strSQL = "insert into guestbook" sn + + "(name, week, jie, content) values ( '" + name + "','" em + + + "','"+ em2 +"','"
Content + "')";
AddBean.executeUpdate (strSQL);
Out.print ( "Your reservation has been saved to the database, thank you!");
) Else if (i == 1) (
If (em.equals ( "7")) (out.print ( "Sunday" + "" + em2 + "section, it was booking, please re-fill single !!");
Else ()
Out.print ( "a week" em + + "" + em2 + "section, it was booking, please re-fill single !!");
)
)
AddBean.close ();
%>
<body Onload="load2()">
<script Language=javascript>
Function load2 () (
Opener.setTimeout ( "submit11 ()", 1500)
Self.setTimeout ( "exit ()", 1500)
)
Function exit () (
Window.close ()
)
</ Script>
</ Body>
(5) dingdan.java documents used to connect databases
Package dingdan; import java.sql .*; public class dingdan (String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver" String sConnStr = "jdbc: odbc: dingdan"; private Connection conn = null; private Statement stmt = null; ResultSet rs = null; public dingdan () (try (Class.forName (sDBDriver);) catch (java.lang.ClassNotFoundException e) (System.err.println ( "dingdan ():" + e.getMessage ()); )) public ResultSet executeQuery (String sql) (try (conn = DriverManager.getConnection (sConnStr); stmt = conn.createStatement (); rs = stmt.executeQuery (sql);) catch (SQLException ex) (System.err.println ( "aq1.executeQuery:" + ex.getMessage ());) return rs;) public void executeUpdate (String sql) (stmt = null; try (conn = DriverManager.getConnection (sConnStr); stmt = conn.createStatement () ; stmt.executeUpdate (sql);) catch (SQLException ex) (System.err.println ( "aq2.executeQuery:" + ex.getMessage ());)) public void closeStmt () (try (stmt.close ()
catch (SQLException e) (e.printStackTrace ();)) public void closeConn () (try (conn.close ();) catch (SQLException e) (e.printStackTrace ();)))
6, compile documents dingdan.java
In order to use dingdan.java, you must use a command line javac compiler of this. Java document.
Will be compiled dingdan.class documents copied to the previously created
C: \ Tomcat 5.0 \ webapps \ yyd \ WEB-INF \ classes \ dingdan under.
7, running
Will be dingdan.html, index1.jsp, add.jsp, ok_add.jsp four documents on c; \ Tomcat 5.0 \ wepapps \ ydd,
Start Tomcat, in the browser address bar type http://127.0.0.1:8080/ydd/dingdan.jsp.
↑ Back
Ajax simple examples
Abstract: simple examples of Ajax
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="219" height="86" align="center" valign="top"> </ td> <td width="465" valign="top">
Ajax, for Asynchronous JavaScript and XML is the use of client-side script and the Web server data exchange Web application development methods. In this way, interactive Web pages do not have to interrupt the process of re-plus CD, can be dynamically updated. Using Ajax, you can create closer to a desktop application, direct, high availability, and even richer, more dynamic Web user interface.
Ajax process
An interactive Ajax from a group called XMLHttpRequest JavaScript objects began. As the name suggests, it allows a client-side scripting to implement HTTP requests, and an XML format will be analytic server response. Ajax the first step in the process is to create a XMLHttpRequest examples. Use HTTP methods (GET or POST) to deal with the request, and will target URL to the XMLHttpRequest object.
Now, remember how Ajax in the first asynchronous processing state? When you send HTTP requests, you do not want to wait for the browser and server hung response Instead, the pages you wish to continue to respond to users through the interactive interface and the server response to the arrival of the real deal with them. To complete it, you can XMLHttpRequest register a callback function, and asynchronous request to distribute XMLHttpRequest. Control immediately be returned to the browser, when the server response arrived, the callback function will be called.
- In the Java Web server, at the request of any other HttpServletRequest and the same. Analytical parameters in the request, servlet implementation of the necessary application logic, will respond to the sequence of XML, and write it back to HttpServletResponse.
</ Td> </ tr> <tr> <td height="20" colspan="2">
</ Td> </ tr> </ table>
Examples
I wrote the following is a simple example:
First, ajaxServlet.java procedures list:
Package com; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse ; / * *———————————————- ——– * Filename: ajaxServlet.java * Create Date: 2005-10-25 * original author: miaohai * Copyright: miaohai * Function: Generating XML documents * * revised record: N / A *————————————————- —– * / public class ajaxServlet extends HttpServlet (private static final String CONTENT_TYPE = "text / xml; charset = gb2312" public void init () throws ServletException () public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException , IOException (response.setContentType (CONTENT_TYPE); response.getWriter PrintWriter out = (); String action = request.getParameter ( "action"); if (( "send"). equals (action)) (StringBuffer sb = new StringBuffer ( "
Sb.append ( "
Sb.append ( "
Sb.append ( "
Sb.append ( "
Out.write (sb.toString ()); out.close ();)))
<head>
</ Head>
<script Type="text/javascript">
/ * XMLHTTP through asynchronous transfer parameters to ajaxServlet sent back to the line with the conditions of XML documents * /
Function getResult () (var url = "/ Test / ajaxServlet? Send action =" if (window.XMLHttpRequest) (req = new XMLHttpRequest ();) else if (window.ActiveXObject) (req = new ActiveXObject ( "Microsoft. XMLHTTP ");) if (req) (req.open (" GET ", url, true); req.onreadystatechange = complete; req.send (null);)) / * return of the XML document * / function complete () (if (req.readyState == 4) (if (req.status == 200) (var type = req.responseXML.getElementsByTagName ( "type_name"); var str = new Array (); for (var i = 0; i <type.length; i + +) (str [i] [i] = type. firstChild.data; document.all [ 'td']. innerHTML + = str [i] + "
";))))
</ Script>
<body OnLoad="getResult()">
<table Width="80%" border="0" cellspacing="0" cellpadding="0">
<tr> <td Id="td"> </ td> </ tr>
</ Table>
</ Body>
Third, web.xml file
<? Xml version = "1.0" encoding = "ISO-8859-1">
Xsi: schemaLocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
Version = "2.4">
4. Diagram:
</ Td> </ tr> <tr>
↑ Back
JSP source holy message boards
Abstract: holy JSP source message board
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="362" height="86" align="center" valign="top">
JSP source holy message boards
Win2k Server procedures Resin + + + Mysql J2sdk Below passed.
Lyb to copy the folder to your virtual directory.
Chclyb copy the folder to X: \ mysql \ data \ Below.
Class class_lyb copied to the folder Below, at the same time changed its name to lyb
Operation http://127.0.0.1:8080/lyb/
See!
If you have any problems please contact
Chen_shengjie@tom.com
PS: There is no copyright.
</ Td> <td width="377" valign="top"> </ td> </ tr> <tr> <td height="20" colspan="2">
</ Td> </ tr> </ table>
</ Td> </ tr> <tr>
↑ Back
How to start in Web Application examples explain the background tasks
Abstract: How to start in Web Application examples explain the background tasks
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle">
We often in Web applications need to write its own services, the purpose of this paper is to provide you with a solution.
<table Width="674" border="0"> <tr> <td width="396">
Principle
The principle of the programme is to write an interface to achieve the ServletContextListener category, there are two such methods:
Public void contextInitialized (ServletContextEvent sce)
It is activated when the call in the application; Another method is:
Public void contextDestroyed (ServletContextEvent sce)
The method is applied at the end of the call.
</ Td> <td width="268"> </ td> </ tr> </ table>
We have to start the application logic on the background contextInitialized method achieved; to release background applications work in the occupied contextDestroyed resources to deal with them. But we started background task is often required, such as time, frequency, and so on, here I use an open-source components: quartz.
Steps
1, writing business called categories:
This is the main function of quartz in the scheduling of the prescribed rules call implement the necessary business logic.
2, writing class scheduling
The purpose of this call is set up the rules, and here I use the "0 / 10 * * * *?" Said that every 10 seconds once.
3, prepared by the start of services:
Calling in contextInitialized TestShedule.run () start background task; contextDestroyed Calling TestShedule.stop () stop background tasks.
4, the deployment of such services launched
In web.xml file add the following line in the configuration:
5, web services can be launched.
Aggregate
In fact, the functions of the realization of this lot, I am here is the application interface and the ServletContextListener revenue api quartz, and hope that you can help the development. Function TempSave (ElementID) (CommentsPersistDiv.setAttribute ( "CommentContent" document.getElementById (ElementID). Value); CommentsPersistDiv.save ( "CommentXMLStore");) function Restore (ElementID) (CommentsPersistDiv.load ( "CommentXMLStore"); document . getElementById (ElementID). CommentsPersistDiv.getAttribute value = ( "CommentContent");) </ td> </ tr> <tr>
↑ Back
Javabean automatically to the source
Abstract: javabean automatically to the source
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="338" height="86" align="left" valign="top">
Following is the source java
ReturnTo.java
Package examples;
Import java.io. *;
Import java.util .*;
Import javax.servlet .*;
Import javax.servlet.http .*;
/ *
Automatic steering javabean
* /
Public class ReturnTo extends HttpServlet
(
Private String Msg;
Private String Rurl;
Private boolean isA;
Public void setMsg (String inMsg) (
This.Msg = inMsg;
)
Public void setRurl (String inRurl) (
This.Rurl = inRurl;
)
Public void setIsA (boolean inisA) (
This.isA = inisA;
)
Public String getMsg () (
Return this.Msg;
)
Public String getRurl () (
Return this.Rurl;
)
Public boolean getIsA () (
Return this.isA;
)
Public void go (HttpServletResponse response) throws IOException, ServletException (
PrintWriter out = response.getWriter ();
Out.print ( "<script language='javascript'>");
If (this.isA) (
Out.print ( "alert ( '" + + "!');"); Msg
)
Out.print ( "location.href = '" + Rurl +"';");
Out.print ( "</ script>");
)
)
Application test.jsp
<% @ Page contentType = "text / html; GBK charset ="%>
<%
String Msg = "automatic shift in ….";
String Url = "http://www.java3z.com";
We.setMsg (Msg);
We.setRurl (Url);
We.setIsA (true);
We.go (response);
%>
Notes:
1: Save the file position
ReturnTo.class ===> web-inf/classes/examples /
Test.jsp arbitrary position
2, wrote this page is not too many of javascript code:) simply frivolous.
3, in testing jdk1.5 tomcat + + win2k3 through.
</ Td> </ tr> <tr> ↑ Back
JavaScript Tutorial (chm format)
Abstract: JavaScript Tutorial (chm format)
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="263" height="86" align="center" valign="top"> </ td> <td width="421" valign="top">
This document information section of the Pacific software production, software belongs to the Pacific station and the author of all documents. The purpose of the production of the document is to facilitate the overwhelming majority of users. Therefore, any person can be free to copy, or in the network spreading the document. However, the document does not allow for the publication or other commercial purposes, the use of the documents in the course of, without permission, the document should not be amended and anti-compiler. Any question please contact us Thank you!
Test you (36)
1) public class Test (
2) public static String output = "";
3) public static void foo (int i) (
4) try (
5) if (i == 1) (
6) throw new Exception ();
7))
output + = "1";
9))
10) catch (Exception e) (
11) output + = "2";
12) return;
13))
14) finally (
15) output + = "3";
16))
17) output + = "4";
18))
19) public static void main (String args []) (
20) foo (0);
21) foo (1);
22)
23))
24))
What is the value of output?
Click for the answer
</ Td> </ tr> <tr> <td height="20" colspan="2">
</ Td> </ tr> </ table>
</ Td> </ tr> <tr>
↑ Back
Tuowan button
Abstract: Tuowan button
</ Td> </ tr> <tr> <td width="440" height="2018" valign="top" class="ArticleTeitle">
Effects of the operation of this program plans: </ Td> <td width="244" valign="top" class="ArticleTeitle"> ↑ Back
Import java.awt .*; import java.awt.geom .*; import javax.swing .*; import javax.swing.plaf.basic .*; import javax.swing.plaf .*; import javax.swing.border. *; public class EllipseButton extends JButton (/ / Constructor - only support this version for demo public EllipseButton (String text) (super (text); / / Create the private UI for the component. The UI / / is a delegate object that handles paint requests for / / the component. this.setUI (EllipseButtonUI.createUI (this)); / / Get rid of the rectangular button border this.setBorder (null); / / Set this so the background of the ellipse will not / / be filled in with the background color this.setContentAreaFilled (false); / / Add a nice chunky margin to give room for the ellipse this.setMargin (new Insets (8, 14, 8, 14));) / / Test frame for our button public static void main (String [] args) (/ / Put a bigger button font in the UIManager UIManager.put ( "Button.font", the new Font ( "Arial", 0, 20)) / / Create a frame and add the button JFrame frame = new JFrame (); frame.setLocation (100, 100); frame.setSize (200, 80); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.setTitle ( "Elliptical Button"); frame.getContentPane (). setLayout (new GridBagLayout ()); EllipseButton button = new EllipseButton ( "Elliptical"); frame.getContentPane (). add (button); / / Set the background to a tasteful color and show the frame frame . getContentPane (). setBackground (new Color (230, 230, 150)); frame.setVisible (true);)) / / This UI delegate is extended from the basic button UI that is / / the base class for all button UI delegates in all PLAFs. class EllipseButtonUI extends BasicButtonUI (/ / Create a singleton instance to share among all instances / / of
</ Td> </ tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle">