In the task of achieving the web plan
Abstract: In the web to achieve mission-planning
</ Td> </ tr> <tr> <td width="473" height="35" valign="top" class="ArticleTeitle">
Package test.timer.MyListener;
Import javax.servlet.ServletContextListener;
Import javax.servlet.ServletContextEvent;
Import java.util.TimerTask;
Import java.util.Timer;
Public class MyListener implements ServletContextListener (
Private java.util.Timer timer = null;
Public void contextInitialized (ServletContextEvent event) (
TimerTask task = new TimerTask () (
Public void run () (
System.out.println ( "Hi");
)
);
Timer = new Timer ();
Event.getServletContext (). Log ( "Timer has been initiated");
Timer.schedule (task, 0, 500);
Event.getServletContext (). Log ( "has been added task plan");
)
Public void contextDestroyed (ServletContextEvent event) (
Timer.cancel ();
Event.getServletContext (). Log ( "Timer closed");
)
) / / Timer on the Web operation in the entire project life cycle, the
Finally, you add a few web.xml:
<listener>
<listener-class> Test.timer.MyListener </ listener-class>
</ Listener>
</ Td> <td width="211" valign="top" class="ArticleTeitle">
</ Td> </ tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle">
↑ Back
JFreeChart generate column
Abstract: JFreeChart generate column
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="700" border="0"> <tr> <td width = " 421 "><%page contentType = "text / html; GBK charset ="%>
<% @ Page import = "java.awt.Color,
Java.awt.Font,
Org.jfree.chart.ChartFactory,
Org.jfree.chart.JFreeChart,
Org.jfree.chart.plot.PlotOrientation,
Org.jfree.chart.servlet.ServletUtilities,
Org.jfree.data.CategoryDataset,
Org.jfree.data.DatasetUtilities,
Org.jfree.chart.plot.CategoryPlot,
Org.jfree.chart.axis.CategoryAxis,
Org.jfree.chart.axis.ValueAxis,
Org.jfree.chart.renderer.BarRenderer3D,
Org.jfree.chart.labels.StandardCategoryItemLabelGenerator,
Org.jfree.chart.axis.AxisLocation "%>
<% </ Td> <td width="269"> </ td> </ tr> </ table>?
Double [] [] data = new double [] [] ((672, 766, 223, 540, 126), (325, 521, 210, 340, 106), (332, 256, 523, 240, 526)) ;
RowKeys String [] = ( "Apple", "pear", "grapes");
ColumnKeys String [] = ( "Beijing," "Shanghai", "Guangzhou", "Chengdu" and "Shenzhen");
CategoryDataset dataset = DatasetUtilities.createCategoryDataset (rowKeys, columnKeys, data);
JFreeChart chart = ChartFactory.createBarChart3D ( "fruit sales plans Statistics,"
Null,
Null,
Dataset,
PlotOrientation.VERTICAL,
True, false, false);
Chart.setBackgroundPaint (Color.WHITE);
CategoryPlot plot = chart.getCategoryPlot ();
CategoryAxis domainAxis = plot.getDomainAxis ();
DomainAxis.setVerticalCategoryLabels (false);
Plot.setDomainAxis (domainAxis);
ValueAxis rangeAxis = plot.getRangeAxis ();
/ / Item set the highest one from the top of the picture and
RangeAxis.setUpperMargin (0.15);
/ / Item set a minimum of the distance between the bottom of the picture
RangeAxis.setLowerMargin (0.15);
Plot.setRangeAxis (rangeAxis);
BarRenderer3D renderer = new BarRenderer3D ();
Renderer.setBaseOutlinePaint (Color.BLACK);
/ / Set the Wall color
Renderer.setWallPaint (Color.gray);
/ / Set up the representative of each fruit color -
Renderer.setSeriesPaint (0, new Color (0, 0, 255));
Renderer.setSeriesPaint (1, new Color (0, 100, 255));
Renderer.setSeriesPaint (2, Color.GREEN);
/ / Set up each region covered by the distance between the parallel columns
Renderer.setItemMargin (0.1);
/ / Show each column values, and modify the font attribute values
Renderer.setItemLabelGenerator (new StandardCategoryItemLabelGenerator ());
Renderer.setItemLabelsVisible (true);
Plot.setRenderer (renderer);
/ / Set-transparency
Plot.setForegroundAlpha (0.6f);
/ / Set up, sales of the display position
Plot.setDomainAxisLocation (AxisLocation.TOP_OR_RIGHT);
Plot.setRangeAxisLocation (AxisLocation.BOTTOM_OR_RIGHT);
String filename = ServletUtilities.saveChartAsPNG (chart, 500, 300, null, session);
String graphURL = request.getContextPath () + "/ servlet / DisplayChart? Filename =" + filename;
%>
"Width = 500 height = 300 border = 0 usemap ="#<%= filename%>">
</ Td> </ tr> <tr>
↑ Back
Code segment: access Cookie
Abstract: The code segment: access Cookie
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="753" border="0"> <tr> <td> </ td> </ tr> </ table>
Protected void setCookie (HttpServletResponse response, String cookieName, String value) (
Cookie cookie = new Cookie (cookieName, value);
Cookie.setPath ("/");
Response.addCookie (cookie);
)
Protected Cookie getCookie (HttpServletRequest request, String name) (
Cookie [] = cookies request.getCookies ();
Cookie returnCookie = null;
If (cookies! = Null) (
For (int i = 0; i <cookies.length; i + +) (
Cookie thisCookie [i] = cookies;
If (thisCookie.getName (). Equals (name)) (
ReturnCookie = thisCookie;
Break;
)
)
)
Return returnCookie;
) </ Td> </ tr> <tr>
↑ Back
The count of simple statistics
Abstract: simple count of Statistics
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="738" border="0"> <tr> <td width = " 732 "> </ td> </ tr> </ table>
JSP recent study. Read a book, read others in the online writing some simple counter, his hands began to write one, and now share. Feeling can be for beginners, it should be learning is a good example, designed to JAVABEAN, SESSION connecting to the database and some simple question, but for beginners, it can deepen the understanding of these concepts.
I do simple statistics, the main anti-updated record of visiting IP, IP number of these simple statistical functions first to design databases. I have a simple ACCESS (mainly the easy-to-use), the first two in the ACCESS in the design table: 1, counter table (including 2: Number, counter) - This table is used to record the number of visits.
2, iptables table (including 2: Number, IP) - This table is used to record the IP address of visitors. Well, good database design, as long as the following on your machine can be registered under the ODBC Rafah, I registered here ODBC data source is counter
Well, I am now the procedure code stickers out:
/ / CounterBean.java
Package yg;
Import java.io. *;
Import java.sql .*;
Public class CounterBean extends Object (
String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String sConnStr = "jdbc: odbc: count";
Private Connection conn = null;
Private Statement stmt = null;
ResultSet rs = null;
/ / Registration database-driven procedures
Public CounterBean () (
Try (
Class.forName (sDBDriver);
)
Catch (java.lang.ClassNotFoundException e) (
System.err.println ( "CounterBean ():" + e.getMessage ());
)
)
/ / Definition of the establishment of a database connectivity and data query
Public ResultSet executeQuery (String sql) (
Rs = null;
Try (
Conn = DriverManager.getConnection (sConnStr);
Stmt = conn.createStatement ();
Rs = stmt.executeQuery (sql);
)
Catch (SQLException e) (
System.err.println ( "executeQuery:" + e.getMessage ());
)
Return rs;
)
/ / Definition of data manipulation
Public void executeUpdate (String sql) (
Stmt = null;
Rs = null;
Try (
Conn = DriverManager.getConnection (sConnStr);
Stmt = conn.createStatement ();
Stmt.executeUpdate (sql);
Stmt.close ();
Conn.close ();
)
Catch (SQLException ex) (
System.err.println ( "executeUpdate:" + ex.getMessage ());
)
)
/ / Database closed
Public void closeStmt () (
Try (
Stmt.close ();
)
Catch (SQLException e) (
E.printStackTrace ();
)
)
Public void closeConn () (
Try (
Conn.close ();
)
Catch (SQLException e) (
E.printStackTrace ();
)
)
/ / Synchronous updated counter
Public synchronized int getcount () (
Int count = 0;
Rs = null;
Try (
ExecuteUpdate ( "update counter set counter = counter +1");
Rs = executeQuery ( "select counter from counter");
Rs.next ();
Count = rs.getInt (the "counter");
Stmt.close ();
Conn.close ();
) Catch (SQLException e) ()
Return count;
)
)
/ / Counter.jsp
<% @ Page contentType = "text / html; gb2312 charset ="%>
<% @ Page import = "yg.CounterBean"%>
<% @ Page import = "java.io. *"%>
<% @ Page import = "java.sql .*"%>
<head>
</ Head>
<body>
<%
String cont = new String ();
String ips = new String ();
Int ipnum = 0;
ResultSet rs;
Rs = null;
If (session.isNew ()) (
Cont = String.valueOf (counter.getcount ());// from visits
Session.putValue ( "count", cont);
Ips = request.getRemoteAddr ();// visitor's IP
Rs = counter.executeQuery ( "select ip from iptables where ip = '" + ips +"'");
If (! Rs.next ())// If there is no record of this IP database
Counter.executeUpdate ( "insert into iptables (ip) values ( '" + ips +"')");// insert a record of IP
)
Rs = counter.executeQuery ( "select ip from iptables");
While (rs.next ()){// statistics of IP
Ipnum ipnum = +1;
)
Counter.closeStmt ();
Counter.closeConn ();
Session.putValue ( "ipnum" String.valueOf (ipnum));
%>
You are the <% = session.getValue ( "count")%> visitors
Your IP address is: <% = request.getRemoteAddr ()%>
At present, there are <% = session.getValue ( "ipnum")%> different IP visited this site
</ Body>
Well, the end, these Rafah. Duality is a rookie, a JAVA beginners, the guidance also looking to the guidance of prawns.
</ Td> </ tr> <tr>
↑ Back
Iframe embedded web usage
Abstract: iframe embedded web usage
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> iframe embedded web usage 
  iframe is not very common, the standard Web page with very little. However, a friend of mine often asked, I am now simply tell us about its use, as long as you pledge to mastering these parameters.
  <iframe> should also be a form of framework, and it Different, iframe can be embedded in any part of the website. We first give an example, the specific code such as:
<iframe Width=420 height=330 frameborder=0 scrolling=auto src=URL> </ iframe> here is the URL can be a relative path, and can also be the absolute path.
  width that width, height that width can be adjusted according to actual situations.
  scrolling pages that would show that the rolling of the optional parameters for the auto, yes, no, if this parameter omitted, the default for the auto.
  Second, how to achieve on the page hyperlinks embedded at this website?
  iframe named to this as long as we can. Is <iframe name =**>, For example, I named aa, write this HTML language <iframe width = 420 height = 330 name = aa frameborder = 0 src = http://www.cctv.com> </ iframe>, and then hyperlink on the web page statement should be written as follows:
  results are as follows, click here: CCTV
  Third, if the frameborder set to 1, the effect is like text box. 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
, The day, month, week visit output statistics
Abstract: in the day, month, week visit output statistics
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> study notes: in the day, month, week visit output statistics
Champion read the article "flexible counter Design and Implementation" and the source (in this article
Http://champion.ewuxi.com/old/opensource/my/count.htm), so this practice. With session to count, it is stored in a visit of xml document, read and write files using the xml Castor.
<table Width="664" border="0"> <tr> <td width="386"> one, which is called jsp page testcount.jsp
<% @ Page import = "java.util.Date"%>
<% @ Page import = "count.CountXml"%>
Calculator test
<%
CountXml xmlcount = CountXml.getInstance ();
If (session.isNew ()) (
Xmlcount.addcount (new Date ());// increase visits
Int n = xmlcount.getTotalCount ();// visit from the total volume
Integer.toString String count = (n);
Session.putValue ( "count", count);
)
</ Td> <td width="268"> </ td> </ tr> </ table>
%>
You are the <% = session.getValue ( "count")%> visitors
Total visits: <% = xmlcount.getTotalCount ()%>
Visited this year: <% = xmlcount.getYearCount ()%>
Visited this month: <% = xmlcount.getMonthCount ()%>
Visited this week: <% = xmlcount.getWeekCount ()%>
The visit of: <% = xmlcount.getDayCount ()%>
Second, the use of the two categories
1, CountXml.java
Package count;
Import java.io.File;
Import java.io.FileReader;
Import java.io.FileWriter;
Import java.io.InputStream;
Import java.util.Properties;
Import java.util.Date;
Import java.text.SimpleDateFormat;
Import java.util.Calendar;
Import org.exolab.castor.xml.Marshaller;
Import org.exolab.castor.xml.Unmarshaller;
(Public class CountXml
Private String fileName = "h: \ \ Tomcat 5.0 \ \ webapps \ \ zz3zcwbwebhome \ \ WEB-INF \ \ xmlcount.xml";
Private static CountObjectInf obj = null;
Private static CountXml instance = null;
Public static CountXml getInstance () (
If (instance == null) (
Instance = new CountXml ();
)
Return instance;
)
Private CountXml () (
Try (
Obj = read (fileName);
) Catch (Exception e) (
System.out.println (e);
)
)
Public int getTotalCount () (
Return obj.getTotalCount ();
)
Public int getDayCount () (
Return obj.getDayCount ();
)
Public int getMonthCount () (
Return obj.getMonthCount ();
)
Public int getWeekCount () (
Return obj.getWeekCount ();
)
Public int getYearCount () (
Return obj.getYearCount ();
)
Public synchronized void addcount (Date da) (/ / count increase compared Date
If (new SimpleDateFormat ( "yyyy-MM-dd"). Format (this.obj.date)
. Equals (new SimpleDateFormat ( "yyyy-MM-dd"). Format (da)))
This.obj.setDayCount (this.obj.getDayCount () + 1);
Else
This.obj.setDayCount (1);
If (new SimpleDateFormat ( "yyyy-MM"). Format (this.obj.date)
. Equals (new SimpleDateFormat ( "yyyy-MM"). Format (da)))
This.obj.setMonthCount (this.obj.getMonthCount () + 1);
Else
Obj.setMonthCount (1);
Calendar ca = Calendar.getInstance ();
Ca.setTime (da);
Ca.setFirstDayOfWeek (Calendar.MONDAY);
If (ca.get (Calendar.DAY_OF_WEEK) == Calendar.MONDAY & &! New SimpleDateFormat ( "yyyy-MM-dd"). Format (this.obj.date). Equals (new SimpleDateFormat ( "yyyy-MM-dd" ). format (da)))
Obj.setWeekCount (1);
Else
Obj.setWeekCount (obj.getWeekCount () + 1);
If (new SimpleDateFormat ( "yyyy"). Format (this.obj.date)
. Equals (new SimpleDateFormat ( "yyyy"). Format (da)))
This.obj.setYearCount (this.obj.getYearCount () + 1);
Else
Obj.setYearCount (1);
Obj.setDate (da);
Obj.setTotalCount (obj.getTotalCount () +1);
Obj.setTempCount (obj.getTempCount () +1);
If (obj.getTempCount ()> = 20) (/ / Only when the temporary visits of more than 20 when the preservation of an equivalent
Obj.setTempCount (0) / / counter to 0
Write (fileName);
)
)
Private void write (String fileName) (
Try (
FileWriter writer = new FileWriter (fileName);
Marshaller.marshal (obj, writer);
Writer.close ();
) Catch (Exception e) (
System.out.println (e);
)
)
Private CountObjectInf read (String fileName) throws Exception (
FileReader reader = new FileReader (fileName);
CountObjectInf result = (CountObjectInf)
Unmarshaller.unmarshal (CountObjectInf.class, reader);
Reader.close ();
Return result;
)
)
2.
Package count;
Import java.util.Date;
(Public class CountObjectInf
/ / Total Total visits
Protected int totalCount = 0;
/ / Day of visit
Protected int dayCount = 0;
/ / Week visits
Protected int weekCount = 0;
/ / Of the visit
Protected int monthCount = 0;
/ / Visit of
Protected int yearCount = 0;
/ / Temporary visits
Protected int tempCount = 0;
Protected Date date = new Date ();
/ **
* @ Return
* /
Public int getDayCount () (
Return dayCount;
)
/ **
* @ Return
* /
Public int getMonthCount () (
Return monthCount;
)
/ **
* @ Return
* /
Public int getTotalCount () (
Return totalCount;
)
/ **
* @ Return
* /
Public int getWeekCount () (
Return weekCount;
)
/ **
* @ Return
* /
Public int getYearCount () (
Return yearCount;
)
/ **
* @ Param i
* /
Public void setDayCount (int i) (
DayCount = i;
)
/ **
* @ Param i
* /
Public void setMonthCount (int i) (
MonthCount = i;
)
/ **
* @ Param i
* /
Public void setTotalCount (int i) (
TotalCount = i;
)
/ **
* @ Param i
* /
Public void setWeekCount (int i) (
WeekCount = i;
)
/ **
* @ Param i
* /
Public void setYearCount (int i) (
YearCount = i;
)
/ **
* @ Return
* /
Public Date getDate () (
Return date;
)
/ **
* @ Param date
* /
Public void setDate (Date date) (
This.date = date;
)
/ **
* @ Return
* /
Public int getTempCount () (
Return tempCount;
)
/ **
* @ Param i
* /
Public void setTempCount (int i) (
TempCount = i;
)
)
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
Jive with the sequence managers do Counter
Abstract: jive sequence managers do Counter
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="682" border="0"> <tr> <td width = " 265 "> </ td> <td width="378"> counter in the production site, if the frequent visits of the number (which, for example, as each additional one, the database will be included in the practice), when your site is much of the visit, it will affect performance. There are two common practice, the first launch of a thread into the regular visits, and the second is to preserve the memory of visits only when visited by up to a certain number (for example, 50) when writing a database. The latter approach was preferable, I started to learn jsp, do not know to write counter, in the sequence that jive very suitable for management "used" as a counter with a little change after using it made its first Home counter (Conversation session with a count). Later read some source code, the master who only know how to write counter.
Package test;
Import java.sql .*;
(Public class SequenceManager
/ **
* Count increment, in the memory of every visit over 50 people when it writes data to the database
* /
Private static final int INCREMENT = 50; </ td> </ tr> </ table>
/ **
* A visit of
* /
Public static long nextID () (
Return nextUniqueID ();
)
/ **
* The current visit of
* /
Public static long currentID () (
Return oldid;
)
Private static long currentID = 0l;
Private static long oldid = 0l;
Private static long maxID = 0l; / / When the memory of the visit this value, update the database.
/ **
* Create a new sequence Manager
* /
Public SequenceManager () (
)
/ **
* Return to a count id.
* /
Public static synchronized long nextUniqueID () (
If (currentID> = maxID) (
GetNextBlock (5); / / database even five times
)
Oldid = currentID;
CurrentID + +;
Return oldid;
)
Private static void getNextBlock (int count) (
Java.sql.Connection Conn = null;
Java.sql.Statement Stmt = null;
Java.sql.ResultSet Rst = null;
If (count == 0) (
System.err.println ( "in an attempt to obtain a final ID, failure, abnormal interruption …");
Return;
)
Boolean success = false;
Try (
String con_string = "jdbc: odbc: cwb";
Class.forName ( "sun.jdbc.odbc.JdbcOdbcDriver");
Conn = DriverManager.getConnection (con_string);
Stmt = Conn.createStatement ();
String sqll = "select * from count_num";
ResultSet rs = Stmt.executeQuery (sqll);
If (! Rs.next ()) (
Throw new SQLException ( "Loading the current ID failed. The" +
"JiveID table may not be correctly populated.");
)
Rs.getLong long currentID1 = (1) / / from the database of visits
CurrentID1 long newID = + INCREMENT; / / visit of plus 50
Sqll = "update count_num set num =" + newID;
If (currentID> = currentID1) = Stmt.executeUpdate success (sqll) == 1;
CurrentID = currentID1;
MaxID = newID;
)
Catch (Exception sqle) (
Sqle.printStackTrace ();
)
Finally (
Try (Stmt.close ();)
Catch (Exception e) (e.printStackTrace ();)
Try (Conn.close ();)
Catch (Exception e) (e.printStackTrace ();)
)
If (! Success) (
System.err.println ( "WARNING: failed to obtain next ID block due to the" +
"Thread contention. Trying again …");
/ / Call this method again, but sleep briefly to try to avoid thread
/ / Contention.
Try (
Thread.currentThread (). Sleep (75);
) Catch (InterruptedException ie) ()
GetNextBlock (count-1) / / recursive calls this method
)
)
)
Test methods and code: (debugging through Tomcat 5)
Access first create a database cwb and create count_num table, there is only one figure in the table-field num, num and insert one for a record jsp test code as follows:
Test.jsp
<% @ Page contentType = "text / html; gb2312 charset ="%>
<% @ Page import = "test .*"%>
<%
String login = (String) session.getAttribute ( "login");
If (login == null) (
%>
Total visits: <% = SequenceManager.nextID ()%>
<%
Session.setAttribute ( "login", "true");
Else ()
%>
Total visits: <% = SequenceManager.currentID ()%>
<%)%> </ Td> </ tr> <tr>
↑ Back
HTML meta major role in small and medium-sized
Abstract: HTML meta major role in small and medium-sized
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle">
Meta in the HTML document is used to simulate HTTP protocol response to the first text. Meta tags for Web pages and <head> </ head>, the usefulness of many meta tags. There are two meta attributes: name and http-equiv. Attribute name used to describe the main page, corresponding to the content (Web content), to facilitate the search engine robots find, classification (currently almost all search engines use the online automatic robot value to the meta search website classification). This is one of the most important description (in the search engine site description) and keywords (Category Key words), so it should be added to every page of a meta value. More common are the following:
<table Width="676" border="0"> <tr> <td width="404"> name attribute
1. To illustrate generation tools (such as Microsoft FrontPage 4.0);
2. To the search engines that your website keywords;
3. You tell the search engine the main content of the site;
Set to follow: links on the page can be enquiries;
Set to noindex: Document will not be retrieved, but the links on the page can be enquiries;
Set to nofollow: Document will not be retrieved, the page links can be enquiries.
Http-equiv attributes </ td> <td width="262"> </ td> </ tr> </ table>
1.
And Home produced to illustrate the text as well as by the use of language;
Also English is the ISO-8859-1 character set, and BIG5, utf-8, shift-Jis, Euc, Koi8-2 character set;
2. Website regularly for a specified period of time n, Jump to http://yourlink pages;
3. Website can be used to set the expiration time, once expired must be redeployed to the server. It must be noted that the time format must be used GMT;
4. Prohibition is set for the browser's cache from the local machine to download pages, once they left after setting on the website can not be transferred again Cache;
5. Cookie settings, if the website expired, archiving the cookie will be deleted. Also need the attention of the GMT time format must be used;
6. Grading of the website, the internet options in IE in an establishment of content, can prevent some restricted to the website, and the web site is restricted by meta-level attributes settings;
7. Mandatory pages in the current window as a separate pages that can prevent their own web pages by others as a page called frame;
8. And
Access to the database connection pool with Proxool
Abstract: Access to the database connection pool with Proxool
</ Td> </ tr> <tr> <td width="473" height="35" valign="top" class="ArticleTeitle"> PropertyFile WEB-INF/classes/Proxool.properties
A lot of small applications are used Access! It also came to a connection pool, a lot of people recommended Proxool.
Proxool-0.8.3.jar first copy to your WEB-INF/lib WEB application, in the case in the web.xml configuration:
Write an attribute of a document WEB-INF/classes/Proxool.propertie
Jdbc-0.proxool.alias = Access
Jdbc-0.proxool.driver-class = sun.jdbc.odbc.JdbcOdbcDriver
Jdbc-0.proxool.driver-url = jdbc: odbc: examination
Jdbc-0.proxool.maximum-connection-count = 10
Jdbc-0.proxool.prototype-count = 4
Jdbc-0.proxool.house-keeping-test-sql = select CURRENT_DATE
Jdbc-0.proxool.verbose = true
Jdbc-0.proxool.statistics = 10s, 1m, 1d
Jdbc-0.proxool.statistics-log-level = DEBUG
Test Method: test.jsp
<% @ Page import = "java.sql .*"%>
<%
Java.sql.Connection Conn;
Java.sql.Statement Stmt;
Java.sql.ResultSet rs = null;
Conn = DriverManager.getConnection ( "proxool.Access");
Stmt = Conn.createStatement ();
%>
Statistics from http://127.0.0.1:8080/test/Admin can enter information pages
</ Td> <td width="209" align="center" valign="top" class="ArticleTeitle">
</ Td> </ tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle">
↑ Back
Using a cookie to track user access to the Web site on time
Abstract: cookie on the user records a site visit time
</ Td> </ tr> <tr> <td width="530" height="35" valign="top" class="ArticleTeitle"> package example; ↑ Back
Import javax.servlet .*;
Import javax.servlet.http .*;
Import java.io. *;
Import java.util .*;
Public class PrevLogin extends HttpServlet (
Public void service (HttpServletRequest req, HttpServletResponse res) throws IOException (
Boolean prevCookie = false;
Cookie myCookie = null;
Cookie [] = req.getCookies cookies ();
String str1 = "before you visit this site";
String str2 = "this is your first visit you!";
Byte1 byte [] = str1.getBytes ();
Byte2 byte [] = str2.getBytes ();
Res.setContentType ( "text / html");
PrintWriter pw = res.getWriter ();
Pw.println ( " ");
Pw.println ( "
If (cookies! = Null) (
For (int ctr = 0; ctr
PrevCookie = true;
MyCookie cookies = [ctr];
)
)
)
If (prevCookie) (
Pw.println (new String (byte1, "8859_1"));
Pw.println (myCookie.getValue ());
Calendar c1 = Calendar.getInstance ();
Date dt = c1.getTime ();
String date = dt.toString ();
MyCookie.setValue (date);
Res.addCookie (myCookie);
PrevCookie = false;
Else ()
Pw.println (new String (byte2, "8859_1"));
Calendar c1 = Calendar.getInstance ();
Date dt = c1.getTime ();
String date = dt.toString ();
MyCookie = new Cookie ( "PrevLogin" date);
Res.addCookie (myCookie);
)
Pw.println ( "</ body>");
Pw.println ( " ");
)
) 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> <td width="181" valign="top" class="ArticleTeitle">
</ Td> </ tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle">