Dream of life to the public information system

  Abstract: Information System dream of life 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="185" height="86" align="center" valign="top"> </ td> <td width="499" valign="top"> 

  ************************************************** ****************** 
  * Information System dream of life [DreamTimeNews] 
*
  * Copyright: Dreaming Days 
  * CopyRight :2006-2007 DreamTime All Rights Reserved 
*
  * Program by: [dream of life] 
  * Email: fanwsp@126.com 
  * QQ: 122142023 
  * HomePage: http://wsp.hniuca.net 
*
  * Solemnly declared: the program only to the individual user free use 
  * Without her consent for commercial use is prohibited! 
*
  * This procedure replication and dissemination of personal welcome, but please ensure that the integrity of the proceedings, 
  * Including all the relevant documents. 
  * Procedures author dreams of life [DreamTime] All rights reserved 
*
  ************************************************** ****************** 

  A description of the procedures: 

  Welcome to the dream of life to the public information system. 

  Procedures based on JSP + JavaBean development, the database can use Access, MySql, MSSQL, Oracle database. 
  Development platform: Win2003 + + Apache2.0.52 Mod_jk Tomcat5.54 + 1.2.6 + JDK1.5 
  Normal procedures required for the operation of JVM (Java Virtual Machine) 1.5 or later. 

  Installation Instructions: 

  1, first of all, to build its own JSP server.    Individual operation or integration with the Apache will do (I use the Apache Tomcat +) copy of the procedures to your server's root directory, I used Tomcat, the default path: Tomcat installation directory / webapps / directory.    Make sure the directory called news system, if the system changes the directory name, the system comes with news picture will be displayed.    If you are prepared to empty the data, you can change the directory you want, please according to practical situation. 

  </ Td> </ tr> </ table> 

  Second, database options: 

  1, if you choose Access database, open the WEB-INF \ classes \ DBConfig.property document, modify DBType value of 0 (ie DBType = 0; This is the default value), and amend the Access database path. 

  2, MySql database if they choose, to please themselves with MySql, and download MYSQL the JDBC driver to configure. 
  + MYSQL good debugging JSP server. 
  Then enter the information system's directory. 
  In mysql prompt implementation: \. DreamNews_MySql.sql. 
  DBType revise the value of, and set your use of drivers. 

  3, if you select the SQL Server database, then you installed SQL Server (at the time of installation Please select mixed mode authentication), 
  Then download the SQL Server JDBC driver to configure. 
  Win2003 Server attention to the installation SQLServer2000 to install patches sp3. 
  + Good JSP debugging SQL Server servers. 
  In the enforcement of sql query analyzer / SQL DreamNews_SQL.sql this angle this can be. 
  DBType revise the value of 2, and set your use of drivers. 

  4, if the use of the Oracle database, Members to resolve. 

  5, Note: Selecting a database must be set correctly corresponding database-driven procedure, if not, please do not change the system 
  The default value. 

  6, please do not change the program directory of news, otherwise the process may not be able to show that picture. 

  Because of the time, I only on the Windows platform under test Tomcat, Resin tested.    Procedures to normal operation. 
  Integration with Apache and IIS software can also above normal operation.    On the Linux operating under, please you to debug, 
  Please send any comments to fanwsp@126.com.    I am not grateful.    I am sure that the future will be tested in the Linux platform. 

  Because of personal effort and time, the information system will inevitably there are many shortcomings, welcome to all of you experts correction. 

  Third, procedures directory structure 
  |——-|—————————————– ———- 
  | - Admin | Manage directory 
  |——-|—————————————– ———- 
  |——-|– Css background CSS file directory 
  |——-|—————————————– ———- 
  |——-|– Help backstage help system directory 
  |——-|—————————————– ———- 
  |——-|– Images background picture catalogue 
  |——-|—————————————– ———- 
  |——-|– Js directory of the paper used JS 
  |——-|—————————————– ———- 
  Add |——-|– AddNews.jsp News 
  |——-|– Admin_Class.jsp category management 
  |——-|– Admin_Config.jsp system parameter settings 
  |——-|– Admin_Info.jsp system set up basic information 
  |——-|– Admin_Left.jsp frame of the left navigation pages 
  |——-|– Admin_Main.jsp main framework pages 
  |——-|– Admin_Special.jsp management topic 
  |——-|– Admin_User.jsp User Management 
  |——-|– DelNews.jsp delete News 
  |——-|– Img.htm upload picture pages 
  |——-|– Index.jsp background listing 
  |——-|– Index_Face.html framework of the right pages 
  |——-|– ListNews.jsp Manage News Pages 
  |——-|– Logout.jsp withdraw from the system pages 
  |——-|– Modifynews.jsp amend News 
  |——-|– Person.jsp administrator personal information pages 
  |——-|– Session.jsp judge whether Trent Login 
  |——-|– VerifyCode.jsp code pages 
  |——-|—————————————– ———- 
  | - Buttonimage eWebEditor editor tool catalogue 
  |——-|—————————————– ———- 
  | - Css CSS file directory 
  |——-|—————————————– ———- 
  |——-|– CoolBlue eWebEditor editor use CSS document 
  |——-|—————————————– ———- 
  |——-|– Newscss prospects of the system used by CSS document 
  |——-|—————————————– ———- 
  | - Editor dialog eWebEditor Pages directory pop-up window 
  |——-|– Images catalogue 
  |——-|—————————————– ———- 
  | - Include eWebEditor editor directory contains documents 
  |——-|—————————————– ———- 
  | - Pic of the system catalogue 
  |——-|—————————————– ———- 
  | - Sql database of the system using the angle of this document 
  |——-|—————————————– ———- 
  | - Sysimge eWebEditor editing system catalogue 
  |——-|—————————————– ———- 
  | - UploadFile upload pictures stored directory 
  |——-|—————————————– ———- 
  | - WEB-INF 
  |——-|—————————————– ———- 
  |——-|– Lib jar package store directory 
  |——-|—————————————– ———- 
  |——-|——-|–|– Dom4j.jar eWebEditor editor own class 
  |——-|——-|–|– DreamNews.jar the system used by the type of document 
  |——-|——-|–|– MYSQL-Driver.jar attached to the system MYSQL Driver 
  |——-|——-|–|– Oracle-Driver.jar the system with the Oracle Driver 
  |——-|——-|–|– MSSQL-Driver.jar fringe of the system of SQL Server Driver 
  |——-|—————————————– ———- 
  |——-|– Classes of document directory 
  |——-|—————————————– ———- 
  |——-|——-|– Src JavaBean source directory 
  |——-|——-|——————————— ———- 
  |——-|——-|–|– AdminClass.java type of source document management 
  |——-|——-|–|– Config.java system settings of source files 
  |——-|——-|–|– DBConnection.java of source document database connection 
  |——-|——-|–|– Function.java common method definition of source files 
  |——-|——-|–|– ListClass.java prospects categories of source files show 
  |——-|——-|–|– Log.java log of source files 
  |——-|——-|–|– Login.java user categories source files 
  |——-|——-|–|– MD5.java MD5 encryption algorithm source files 
  |——-|——-|–|– News.java news source document management category 
  |——-|——-|–|– ShowNews.java news show that the source of documents 
  |——-|——-|–|– User.java users of source document management 
  |——-|——-|–|– VerifyCode.java verification of the source code files 
  |——-|—————————————– ———- 
  |——-|——-|– DBConfig.property database configuration file 
  |——-|—————————————– ———- 
  |——-|– Button.xml eWebEditor pattern definition file editor 
  |——-|– DreamNews.mdb Access database 
  |——-|– Style.xml eWebEditor pattern definition file editor 
  |——-|– Web.xml configuration page applications 
  |——-|—————————————– ———- 
  | - Config. Jsp pages of the system configuration 
  | - EWebEditor. Jsp eWebEditor editor of Home 
  | - Index. Jsp Home of the system 
  | - ReadClass. Jsp major categories showed that the system pages 
  | - ReadSClass. Jsp pages of the system shows that subcategory 
  | - Search. Jsp pages of the system News Search 
  | - Special. Jsp pages display feature of the system 
  | - Top. Head of the system of public jsp pages 
  | - Upload. Jsp eWebEditor file upload pages editor 
  | - Note. Txt file this note 
  |————————————————- ———– 

  By DreamTime 2006.3.24 

  ************* Special thanks to [clouds floating by Arrow] ************ 

  Manage: 
  Address: admin / index.jsp must enter the file name index.jsp, or can not sign. 
  Username: admin 
  Password: admin 

  </ Td> </ tr> <tr> 

  ↑ Back 

BBS system of virtual community

  Abstract: BBS system of virtual community 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="727" height="32" border="0"> <tr> <td> </ td> </ tr> </ table> 
  BBS is a JSP-CS + + Servlet JavaBean development of a virtual community network system. 
  Platform: 
  JDK Liunx + + + Apache Tomcat + MYSQL or Windows2000 (WindowsNT, Windows98) + + + Apache Tomcat JDK + MYSQL 
  BBS-CS file structure: 
  BBS-CS in the packet of documents in the home, src, jar, doc four directory. 
  Of which: home of a procedural document, under src source, the jar is a tool kit, doc file under. 

  : 
  The software belongs to the author Tian Yi Gong Web site and BBS-CS (http://www.laoer.com), and love studio (http://www.loveroom.com.cn) site, a person shall not be used for commercial purposes (that is not the sale, distribution, and if this software to build business or personal website, please email to laoer@vip.163.com to statistics for the record, and must be preserved at the same time love studio advertising and copyright statement), if need commercial support, will be charged a fee, but not of the software sold.    JSP software for the purpose of this study to examine the use of lovers, Web sites and BBS-CS love studio will provide the software upgrade.    </ Td> </ tr> <tr> 

  ↑ Back 

Multi-user site statistics system

  Abstract: multi-user site statistics system 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="270" height="86" align="center" valign="top"> </ td> <td width="414" valign="top"> 

  ================================================== ============= 
  = Jsp technology of multi-user site statistics system = 
  = Copyright: xwj = 
  = Procedures by: xwj = 

  = E-mail: xuwj@hsdchina.com = 

  = Home Address: http://www.hsdchina.com = 

  ================================================== ================ =:: solemnly declare:: = 
  1, where the author cited Please maintain copyright.  =
  2, where the function will not modify any technical support and source code no longer available.  =
  3, this procedure only provided free of charge to individuals, if commercial websites to use this procedure, please contact I 
  ================================================== ============= 

  </ Td> </ tr> </ table> 

  Note: tomcat4.0.6 tomcat 5 test pass 

  Main features: 

  1, connect users online applications with immediate effect. 
  2, the site if the user changes the data can be changed at any time, if you forget the code, the code can be re-access! 
  3, line managers can modify or delete user data! 
  4, administrators can initialize data! 
  5, administrators can set the opening of the application in accordance with the maximum number of applications, each set up to show that the number of users more detailed information, such as detailed information deleted! 
  6, administrators can be online compression, backup, recovery, database! 
  7, click on Top! 
  8, statistics into the year, month, week, day, software statistics, and the overall data Show this year, this month, this week, today, last month, yesterday's statistics, etc. 
  9, currently only supports English User 

  Use easy-to-use database Universal Database Mysql database: webtj 

  Installation Instructions: 

  WebStatistic directly to the entire folder, or other tomcat deployed to the application server deployment directory, 
  Modify the database configuration file webStatistic \ WEB-INF \ classes \ xwj \ DbConfig.properties inside the parameters of the correct parameters, 
  Then start tomcat or other application server in the browser, type "http:// your website / webtj / can be." 
  Http://localhost:8080/webtj 
  For security you account management changes super: 
  1, you can first apply for a user 
  2, then as an administrator landing "super management" 
  Administrators initial user: admin Password: admin 
  3, into account, change your data 

  Management: 

  If, management of individual user information, you can enter [User List], this time, you will find "site name" multi-user connectivity editorial, 
  (The link landing only you will not be seen until after the super-user) 

  Xwj 

  </ Td> </ tr> <tr> 

  ↑ Back 

Log4j log management system using a simple note

  Abstract: Log4j log management system using a simple note 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> 
  <table Width="673" border="0"> <tr> <td width="265"> </ td> <td width="398"> Log4j log management system using a simple note 

  Log4j has three main components: Loggers, and Layouts Appenders here can be understood as a simple log type, log output to the local and export log in what form.    Integrated use of these three components can be easily record of the type and level of information, and to be running log export control pattern and location.    Below the three separate components: 

  1, Loggers 

  Loggers components in this system are divided into five levels: DEBUG, INFO, WARN, and FATAL ERROR.    This is a five-level order: 

  DEBUG <INFO <WARN <ERROR <FATAL 

  Understand that this is one very important point here Log4j have a rule: Loggers assumption that the level of P, if the Loggers had occurred in one of the high-level Q, P, it can activate, otherwise suppress. 
  </ Td> </ tr> </ table> 
  For example, Java programs: 

  / / Build Logger an example, the name "com.foo" 
  Logger logger = Logger.getLogger ( "com.foo"); 
  / / Set the logger level.    Procedures are usually not set the level logger.    General settings in the configuration file. 
  Logger.setLevel (Level.INFO); 
  Logger barlogger = Logger.getLogger ( "com.foo.Bar"); 
  / / Below this request available, because WARN> = INFO 
  Logger.warn ( "Low fuel level."); 
  / / Below this request can not be used because DEBUG <INFO 
  Logger.debug ( "Starting search for nearest gas station."); 
  / / The name "com.foo.bar" examples barlogger will inherit an example "com.foo" level.    Thus, the following this request available, because INFO> = INFO 
  Barlogger.info ( "Located nearest gas station."); 
  / / Below this request can not be used because DEBUG <INFO 
  Barlogger.debug ( "Exiting gas station search"); 

  Here "is available" means Logger can output information. 

  In the name of the Logger example, no restriction could be of interest from arbitrary name.    Under normal circumstances recommendations to the location of the named Logger example, it is more effective in terms of the Logger naming.    This makes each category to build their own log information, manageable.    For example: 

  Static Logger logger = Logger.getLogger (ClientWithLog4j.class.getName ()); 

  2, Appenders 

  Banned the use of log request only Log4j one of the small places, Log4j log system allows the log output to different places, such as the console (Console), paper (Files), according to the number of days or file size of a new document, to flow in the form sent to other places, and so on. 

  Its syntax is expressed as: 

  Org.apache.log4j.ConsoleAppender (console), 
  Org.apache.log4j.FileAppender (document), 
  Org.apache.log4j.DailyRollingFileAppender (produce a daily log file) 
  Org.apache.log4j.RollingFileAppender (file size, arrived at the designated size and it is a new document) 
  Org.apache.log4j.WriterAppender (log information to be sent to any format-designated place) 

  Configuration for use: 

  Log4j.appender.appenderName = fully.qualified.name.of.appender.class 
  Log4j.appender.appenderName.option1 = value1 
…
  Log4j.appender.appenderName.option = valueN 
  This log on to the output to provide a great convenience. 

  3, Layouts 

  Sometimes users want according to their own preferences formatted log output.    Log4j can be in the back of additional Layouts Appenders to complete this function.    Layouts offers four log output format, such as HTML styles according to specified forms, including log-level and the information contained logs and the style of the time, thread, patterns of the types of information and so on. 

  Its syntax is expressed as: 

  Org.apache.log4j.HTMLLayout (HTML table form layout), 
  Org.apache.log4j.PatternLayout (the flexibility to specify the layout mode), 
  Org.apache.log4j.SimpleLayout (including log information and the level of information string), 
  Org.apache.log4j.TTCCLayout (including log the time, thread, type information, etc.) 

  Configuration for use: 

  Log4j.appender.appenderName.layout = fully.qualified.name.of.layout.class 
  Log4j.appender.appenderName.layout.option1 = value1 
…
  Log4j.appender.appenderName.layout.option = valueN 

  The above is from the Log4j Principle shows the use of the Java programming in specific Log4j can refer to the use of the following examples: 
  1, the establishment of Logger examples: 
  Grammar: public static Logger getLogger (String name) 
  Actual use: static Logger logger = Logger.getLogger (ServerWithLog4j.class.getName ()); 
  2, read configuration files: 
  Logger obtained examples, the following will be configured Log4j use of the environment: 
  Grammar said: 
  BasicConfigurator.configure (): Automatic use of default Log4j environment. 
  PropertyConfigurator.configure (String configFilename): Read the use of the characteristics of Java document prepared by the configuration files. 
  DOMConfigurator.configure (String filename): Read the form of XML configuration files. 
  Actual use: PropertyConfigurator.configure ( "ServerWithLog4j.properties"); 
  3, insert the log information to complete the above steps, even after Below can log on at different levels should insert into your log records any place. 
  Grammar said: 
  Logger.debug (Object message); 
  Logger.info (Object message); 
  Logger.warn (Object message); 
  Logger.error (Object message); 
  Actual use: logger.info ( "ServerSocket before accept:" + server); 

  In the actual programming, to make Log4j really running on the system configuration files prior to the definition.    Logger step is the definition, the difference between Appender and Layout use, as follows: 
  1, root Logger configuration, its syntax: 
  Log4j.rootLogger = [level], appenderName, appenderName,… 
  Logger level here that the priority, appenderName log information is output, multiple output can be designated to.    Such as: log4j.rootLogger = INFO, A1, A2 
  2, configuration information log output destination, its syntax: 
  Log4j.appender.appenderName = fully.qualified.name.of.appender.class 
  Can be specified above a five destinations. 
  3, configuration information log format, syntax: 
  Log4j.appender.appenderName.layout = fully.qualified.name.of.layout.class 
  Here is the above three steps in front of the Log4j components of a simplified; Below is a specific configuration examples, in the light of the implementation process can be: 
  Log4j.rootLogger = INFO, A1 
  Log4j.appender.A1 = org.apache.log4j.ConsoleAppender 
  Log4j.appender.A1.layout = org.apache.log4j.PatternLayout 
  4r-log4j.appender.A1.layout.ConversionPattern =%% d%-5p (yyyy-MM-dd HH: mm: ssS)% c% m% n 
  It should be stated here is the log information in the format represented by the symbols of several meanings: 
  - X: X information output left-justified; 
  % P:-log information 
  % D (): log information Generation 
  % C: Logs site (category) 
  % M: the log specific information 
  % N: output log information for firms 

  According to the above log format, the output of a particular procedure was as follows: 
  0 INFO 2003-06-13 13:23:46968 ClientWithLog4j Client socket: Socket [addr = localhost/127.0.0.1, port = 8002, 2014 = localport] 
  16 DEBUG 2003-06-13 13:23:46984 ClientWithLog4j Server says: 'Java server with log4j, Fri Jun 13 13:23:46 CST 2003' 
  16 DEBUG 2003-06-13 13:23:46984 ClientWithLog4j GOOD 
  16 DEBUG 2003-06-13 13:23:46984 ClientWithLog4j Server responds: 'Command' HELLO 'not understood.' 
  16 DEBUG 2003-06-13 13:23:46984 ClientWithLog4j HELP 
  16 DEBUG 2003-06-13 13:23:46984 ClientWithLog4j Server responds: 'Vocabulary: HELP QUIT' 
  16 DEBUG 2003-06-13 13:23:46984 ClientWithLog4j QUIT 

  </ Td> </ tr> <tr> 

  ↑ Back 

JSF examples of learning - Pisa (pizza) ordering system.

  Abstract: JSF examples of learning - Pisa (pizza) ordering system. 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> 

  JavaServer Face for the Java application development speed. 

  JavaServer Faces (JSF) is a Java technology used to quickly build Web applications of the new technology.    JSF through the provision of the following features to speed up the development process: 
  Standards and scalable user interface components; vulnerable configuration pages navigation; certification for the importation of components; automation Bean management; incident; easily error handling, 
  And built-in support of the international. 

  This paper describes how to use JSF to build online Pisa (pizza) ordering system. 

  Job description 

class=bodycopy>   The application is called PizzaRia is an online store that allows users to choose pizza and submit selected pizza.    PizzaRia similar with other online stores, 
  Users can browse the menu, add to the shopping cart and checkout selected products. 

  The application's user interface from five JSP document composition, they are index.jsp, details.jsp, shoppingCart.jsp, checkOut.jsp and order.jsp. 
  Each user interface pages, including three other pages: header.jsp, menu.jsp and footer.jsp 

  Users shopping process: the store to view the goods detailed information, shopping (Add to Cart), checkout, payment. 

  <table Width="100%" align=center> <tr> <td align=middle> </ td> </ tr> </ table> 

  <table Width="100%" align=center> <tr> <td align=middle> </ td> </ tr> </ table> 

  <table Width="100%" align=center> <tr> <td align=middle> </ td> </ tr> </ table> 

  <table Width="100%" align=center> <tr> <td align=middle> </ td> </ tr> </ table> <table width="100%" align=center> <tr> <td height = "453" align = middle> </ td> </ tr> </ table> 

  Database 

  The procedure of data stored in three forms: products (products), orders (orders) and OrderDetails (orders detailed project).    Products Table information storage products, has four: ProductId (product logo), Name (name), Description (Note), and Price (prices). 

class=bodycopy style1>   Orders table for each row in a separate storage of orders, the information including contact names, addresses and credit card details of delivery.    Orders Table 6 are: 
  OrderId (orders logo), ContactName (contact name), DeliveryAddress (postal address), CCName (credit card belonging name), 
  CCNumber (credit card numbers) and CCExpiryDate (credit card expiration date). 

  Each of the detailed project orders in the OrderDetails be stored in the table.    OrderDetails table with four: OrderId (orders logo), ProductId (product logo), 
  Quantity (quantity) and Price (prices).    Orders and OrderDetails through OrderID table included one-to-many relationship.    Please note that the user table OrderDetails orders on the preservation of the relevant price information.    The prices may be different with the current product prices, which stored in the table Products Price column. 

  In an Oracle database used to create the necessary tables script files stored in pizzaria-oracle.sql pizzaria.zip document. 

  Business Object 

  Following is the application used in the business object: 

  ProductBean package for a product information.    It has the following attributes: id (logo), the name (name), description (Note), and price (prices). 
  Details.jsp each page visited, JSF Implementation (implementation) will automatically create a ProductBean examples.    The JSF Implementation call ProductBean 
  No parameters of the structure, from the database access to the relevant data, and will fill its corresponding word column. 

  ProductSummary.    ProductSummary (Product Overview) for a summary of that product.    These include two attributes: id (identification) and the name (name). 

  ShoppingItemBean.    ShoppingItemBean shopping for that item.    These include four attributes: productId (product logo), productName 
  (Product name), the price (price), as well as quantity (number). 

  ShoppingCartBean.    ShoppingCartBean used for storage in a dialogue (session) objects in the cart.    Allows users to add such items (using addShopping methods), including all access to a list of items (using getShoppingItems method), and was purchased by the total value of goods (used getTotal methods). 

  OrderBean.    OrderBean said that one orders.    Such has the following five attributes: contactName, deliveryAddress, creditCardName, 
  CreditCardNumber and creditCardExpiryDate. 

  MenuBean.    MenuBean getMenu method showed that the use of products for the directory.    The method returns a product contains details of the link to the HTML table. 
  Package pizzaria; 

  Import java.util.ArrayList; 
  Import java.util.Iterator; 
  Import javax.faces.context.FacesContext; 
  Import javax.servlet.ServletContext; 

  (Public class MenuBean 

  String browsePage = "details.jsp"; 
  Public String getBrowsePage () ( 
  Return browsePage; 
  ) 

  Public void setBrowsePage (String page) ( 
  BrowsePage = page; 
  ) 

  Public String getMenu () ( 
  / / Get DatabaseUtil instance 
  FacesContext facesContext = FacesContext.getCurrentInstance (); 
  ServletContext servletContext = (ServletContext) facesContext.getExternalContext (). GetContext (); 
  DatabaseUtil dbUtil = (DatabaseUtil) servletContext.getAttribute ( "DATABASE_UTIL"); 

  StringBuffer buffer = new StringBuffer (512); 
  Buffer.append ( "<table> \ n"); 
  ArrayList summaries = dbUtil.getProductSummaries (); 
  = Summaries.iterator Iterator iterator (); 
  While (iterator.hasNext ()) ( 
  ProductSummary summary = (ProductSummary) iterator.next (); 
  Buffer.append ( "<tr> <td>"); 
  Buffer.append ( "" + 
  Summary.getName () + ""); 
  Buffer.append ( "</ td> </ tr> \ n"); 
  ) 
  Buffer.append ( "</ table> \ n"); 
  Return buffer.toString (); 
  ) 
  ) 

  DatabaseUtil.    DatabaseUtil provided the following three kinds of methods to access and manipulate data: 

  •   GetProductSummaries: The method returns a product contains a summary table in a list of all products.    Overview of a product category to ProductSummary said. 

  •   GetProductDetails: ProductBean the method returns an object, the object identifier package with a specific product details. 

    class=bodycopy>   InsertOrder: The method to the Orders and OrderDetails Table Insert Table customer orders. 

  Application context sniffers 

class=bodycopy style1>   Application context sniffers (AppContextListener) read out from the web.xml file access the database for the initial parameters, and then be incorporated into 
  ServletContext object.    The initial use parameters are as follows: jdbcDriver, dbUrl, dbUserName and dbPassword.    In your web.xml file edit these values in order to reflect the true value of your database. 

  Package pizzaria; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class AppContextListener implements ServletContextListener (/ / web.xml file read Servlet context initialization parameters, construct a DatabaseUtil Object public void contextInitialized (ServletContextEvent event) (DatabaseUtil dbUtil = new DatabaseUtil (); ServletContext servletContext = event.getServletContext (); String jdbcDriver = servletContext.getInitParameter ( "jdbcDriver"); String dbUrl = servletContext.getInitParameter ( "dbUrl"); String dbUserName = servletContext.getInitParameter ( "dbUserName"); String dbPassword = servletContext.getInitParameter ( "dbPassword"); dbUtil.setJdbcDriver (jdbcDriver); dbUtil.setDbUrl (dbUrl); dbUtil.setDbUserName (dbUserName); dbUtil.setDbPassword (dbPassword ); servletContext.setAttribute ( "DATABASE_UTIL" dbUtil);) public void contextDestroyed (ServletContextEvent event) (ServletContext servletContext = event.getServletContext (); servletContext.removeAttribute ( "DATABASE_UTIL");)) 

  JSF application configuration 

class=bodycopy style1>   JSF allows programmers only through the application process configuration files can be easily configured applications.    If the document exists, then it should be named for the faces-config.xml, and should be in your application under the WEB-INF directory. 

  In the faces-config.xml file in the application's configuration in many aspects, including bean management, page navigation, custom UI (user interface) components, 
  Custom verification procedures and information resources.    In PizzaRia application, I used the faces-config.xml bean management and navigation pages of the configuration. 

  <? Xml version = "1.0"> 
  Faces-config PUBLIC 
  "- / / Sun Microsystems, Inc / / DTD JavaServer Faces Config 1.0 / / EN" 
  "Http://java.sun.com/dtd/web-facesconfig_1_0.dtd"> 


  MenuBean 
  Pizzaria.MenuBean 
  Application 


  ProductBean 
  Pizzaria.ProductBean 
  Request 


  ShoppingCartBean 
  Pizzaria.ShoppingCartBean 
  Session 


  OrderBean 
  Pizzaria.OrderBean 
  Session 


  / Details.jsp 

  / ShoppingCart.jsp 



  / ShoppingCart.jsp 

  CheckOut 
  / CheckOut.jsp 



  / CheckOut.jsp 

  Order 
  / Order.jsp 


  Incident 

  In this application, developers need a AppAction Listener called the ActionListener.    ProcessAction ActionEvent its way from the target getLocalValue acquire passed to the method of local values.    If the local value of "Buy (purchase)," then processAction users with access to relevant ShoppingCartBean objects, and will shoppingItem to join in the bean.    If the local value of "pay (payment)," then processAction from the session (session) objects and object access OrderBean ShoppingCartBean object, and call DatabaseUtil insertOrder object methods. 

  Package pizzaria; import java.util.Map; import javax.faces.FactoryFinder; import javax.faces.application.Application; import javax.faces.application.ApplicationFactory; import javax.faces.component.UICommand; import javax.faces.context . FacesContext; import javax.faces.el.ValueBinding; import javax.faces.event.ActionEvent; import javax.faces.event.ActionListener; import javax.servlet.ServletContext; public class AppActionListener implements ActionListener (public void processAction (ActionEvent event) = (FacesContext facesContext FacesContext.getCurrentInstance (); String localValue = (String) ((UICommand) event.getComponent ()). getValue (); if (the "Buy." equals (localValue)) (String productId = (String) facesContext . getExternalContext (). getRequestParameterMap (). get ( "myForm: productId"); Map sessionMap = facesContext.getExternalContext (). getSessionMap (); ShoppingCartBean cart = (ShoppingCartBean) sessionMap.get ( "shoppingCartBean"); if (cart = = null) (cart = new ShoppingCartBean ();// create Cart sessionMap.put ( "shoppingCartBean" cart);) = getDatabaseUtil ProductBean product (). getProductDetails (productId); ShoppingItemBean shoppingItem = new ShoppingItemBean (product.getId (), product.getName (), product.getPrice (), 1); cart.addShoppingItem (shoppingItem);) else if ( "Pay." equals (localValue)) (/ / insert a record into the database OrderBean order = (OrderBean) getValueBinding ( "# (orderBean)"). getValue (facesContext); ShoppingCartBean cart = (ShoppingCartBean) getValueBinding ( "# (shoppingCartBean)"). getValue (facesContext); if (cart! = null & order! = null ) (getDatabaseUtil (). insertOrder (order, the cart); / / empty shopping cart cart.removeShoppingItems ();))) private ValueBinding getValueBinding (String valueRef) (ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory (FactoryFinder.APPLICATION_FACTORY); Application application = factory.getApplication (); return application.createValueBinding (valueRef);) private DatabaseUtil getDatabaseUtil () = (FacesContext facesContext FacesContext.getCurrentInstance (); ServletContext servletContext = (ServletContext) facesContext.getExternalContext (). getContext (); return (DatabaseUtil) servletContext.getAttribute ( "DATABASE_UTIL");)) 

  AppActionListener of the use of two very useful approach: getValueBinding and getDatabaseUtil.    GetValueBinding accept the designated target of a string, and returns an object of type down conversion ValueBinding type of object.    For example, in order to obtain user in the application configuration file to be registered as shoppingCartBean ShoppingCartBean example, developers need to transfer through "shoppingCartBean" to call getValueBinding. 

  ShoppingCartBean cart = (ShoppingCartBean) getValueBinding ( "# (shoppingCartBean)"). GetValue (facesContext); 
  GetDatabaseUtil method returns an DatabaseUtil ServletContext of the examples cited: 

  Private DatabaseUtil getDatabaseUtil () = (FacesContext facesContext FacesContext.getCurrentInstance (); ServletContext servletContext = (ServletContext) facesContext.getExternalContext (). GetContext (); return (DatabaseUtil) servletContext.getAttribute ( "DATABASE_UTIL");) operational procedures: http: / / 127.0.0.1:8080 / pizza / faces / index.jsp 

  The original author PizzaRia JSF applications using JavaServer Faces [JSF] 1.0.    In order to facilitate learning, the station will use its jsf1.1 + Access, and rewrite all jsp document.    Please download the source code analysis. 

  </ Td> </ tr> <tr> 

  ↑ Back 

Database-based mail system

  Abstract: Based on the e-mail system database 

  </ Td> </ tr> <tr> <td width="494" height="35" valign="top" class="ArticleTeitle"> 

  Database-based mail system, the procedures for lovers exchange purposes. 

  More attention please http://iNENS.onchina.net http://iNENS.my163.com 

  INENS provide on-ice production 

  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");) 

  Have a written menu, Figure: 

  </ Td> <td width="190" valign="top" class="ArticleTeitle"> 
  </ Td> </ tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle"> 

  ↑ Back 

Monsoon flow statistical system v1.0 (JSP)

  Abstract: monsoon flow statistical system v1.0 (JSP) 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> 
  <table Width="735" border="0"> <tr> <td> </ td> </ tr> </ table> 
  [First] language 
  Thank you very much to the monsoon flow interested in statistical systems.    Whether you are a beginner JAVA, or JAVA, a master, I am sure you said that the Chinese side JAVA technology development, and even China's software industry development, we must rely on those of us in the software development interested persons. 
  [Note] 
  The system is completely open source code, no reservations, no registration, it is completely free.    Members prawns may also visit the source code, modify and optimize freedom, as far as possible a better version launched for the large number of users downloaded free of charge.    The multi-user system Xiaoxiang Statistics System (asp version) picture, I would like to thank the Internet icon to the Forum provided free of charge, source of technical staff, Thank you. 
  [Function] 
  1: Multi-User statistics system to prevent refresh speed, extensive application 
  2: Comprehensive statistics, a recent visit, regional analysis, address analysis, screen size, page visits, number of visits, the operating system, is online, IP address, browser, the statements, statements, Zhou statements, historical statements, the statements etc. 
  3: precise tracking of every visitor's IP and online - the same IP online every five minutes to add a count (you can change the time, you stat.jsp page you want to read ExTime time, int ExTime = 5;). 
  4: to provide detailed IP data packets, allows you to clear the visit is to know where is. 

  It is always the best, you can monitor who is now in a browser, your web site that you visit the columns 
  [Configuration] 
  This directory to the "feng" catalog copy to your virtual directory: \ \ WEB-INF \ classes \ under. 

  The system used here ACCESS database. 
  Data Source Name: count, the user name: admin, Password: admin (jdbc.java document can change the code, and then compile). 
  Database: count.mdb 
  Preparation of the environment: win2000 + j2sdk1.4.0_02 + tomcat4.0 
  Test page: test.jsp (you can see the effect of Statistics) 

  [Management] system 
  After the completion of the allocation, open system home page, click [management] link, enter your user name, password, if it is the system administrator can then modify, delete, view all the information the website registration, or you can modify, check their website information. 
  After the phrase: 
  Use of this system in the process, if found wrong, and the system BUG any recommendations on the Forum's comments, criticisms, please MAIL: feng0904@163.com.    I of the QQ: 9183838.    Also welcomes the broad masses of netizens in the study and application: Delphi, JAVA, asp problems encountered in the process of exploring with me, we make progress. 

  QQ: 9183838 
  E-Mail: feng0904@163.com 
  Web site: http://www.hxwa.net April 2003 
  Monsoon 
  Changsha, Hunan. Function TempSave-way information (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 

Smart fan system in the establishment of JSP version

  Abstract: The establishment of smart fan system JSP version 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td height="53" align="center" valign="top"> </ td> </ tr> <tr> <td height="20"> 

  Module2 a structure of the whole site JSP source station, installation testing methods: 

  1. WebModule2.zip download, extract and TOMCAT WebModule2 directory Add to the webapps directory. 

  2.    JdbcBean.java database for the configuration files, databases basic.mdb attention to the location of: 
  E: / Tomcat 5.0/webapps/WebModule2/WEB-INF/basic.mdb 

  This is the ini JdbcBean.java () method in the set. 
  Private void ini () (throws SQLException 
  Try ( 
  Class.forName ( "sun.jdbc.odbc.JdbcOdbcDriver"); 
  If ((con == null) | | con.isClosed ()) 
  Con = DriverManager.getConnection ( "jdbc: odbc: Driver = (Microsoft Access Driver (*. mdb)); DBQ = E: / Tomcat 5.0/webapps/WebModule2/WEB-INF/basic.mdb"); 
  Stmt = con.createStatement (); 
  ) 
  Catch (SQLException e) ( 
  Throw e; 
  ) Catch (Exception e) ( 
  System.out.println ( "load driver error"); 
  ) 

  ) 
  Figure effect: 

  </ Td> </ tr> </ table> </ td> </ tr> <tr> 

  ↑ Back 

JSP massive statistical system (version 1.0)

  Abstract: JSP massive statistical system (version 1.0) 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="271" height="86" align="center" valign="top"> </ td> <td width="413" valign="top"> 

  Massive Statistics Systems Version 1.0 (JSP) process Author: Xiaolei 

  QQ: 6404040 E-Mail: kkg365@21cn.com 
  Web site: http://kkg365.cn.st 

  [Copyright] 

  The software for sharing software (shareware) to provide free access to personal website, 
  Do not illegally modified, reproduce, spread 
  Profit or for other acts, and do not delete the copyright statement. 

  If you encountered in the use of a problem, I go to the website of http://kkg365.cn.st question. 

  </ Td> </ tr> <tr> <td height="20" colspan="2"> 

  [Installation] 

  1; please download and install seadealstat.rar, unzip to JSP webapps directory server, start the server 

  [Configuration] 

  1; this directory "sds" catalog copy to your virtual directory: \ \ WEB-INF \ classes \ under. 
  Laws sds count.java folder in the paper to find 
  String url = "jdbc: odbc: driver = (Microsoft Access Driver 

  (*. Mdb)); DBQ = E: / / www / / counts / / data / / stats.mdb "; 
  Here, "E: / / www / / counts / / data / / stats.mdb" data folder database (stats.mdb) path, according to the number you 

  According to the document (stats.mdb) placement self-Laws (it is best to use absolute path), the revised compiler count.java. 

  2; config.jsp modify the content of the paper, specifically in the document to see that. 

  [To] use embedded code 

  According to show that you need to get the appearance you want to statistics in the pages of the code can be placed as follows: 

  Note: Below the code should be "http://kkg365.126.com/" to your actual installation location 

  1, does not display any content 
  <script Src="http://kkg365.126.com/counts/mystat.jsp"> </ script> 
  2, showed that the total number of visits (text) 
  <script Src="http://kkg365.126.com/counts/mystat.jsp?style=text"> </ script> 
  3, shows that small icon 
  <script Src="http://kkg365.126.com/counts/stat.jsp?style=icon"> </ script> 

  [After] language 

  Use of this system in the process, if found wrong, and the system BUG any suggestions, criticisms, please E-MAIL: kkg365@21cn.com. 

  I of the QQ: 6404040.    Our aim is not only the best better.    100 late last wish you all success,. 

  Graph: 

  </ Td> </ tr> </ table> 

  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 metric system of binary

  Abstract: binary and decimal 

  </ Td> </ tr> <tr> <td width="516" height="35" valign="top" class="ArticleTeitle"> import java.io. *; 
  (Public class PrintBits 
  Public static void main (String [] args) throws IOException 
  ( 
  BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); 
  System.out.println ( "input int:"); 
  String s = br.readLine (); 
  Int val = Integer.parseInt (s); 
  System.out.println (getBits (val)); 
  ) 

  Public static String getBits (int value) ( 
  Int displayMask = 1 <<31; 
  StringBuffer buf = new StringBuffer (35); 
  For (int c = 1; c <= 32; c + +) ( 
  Buf.append ((value & displayMask) == 0?'0 ':'1'); 
  Value <<= 1; 
  If (c == 0% 8) 
  Buf.append ( ''); 
  ) 
  Return buf.toString (); 
  ) 
  ) 

  Running Results: 
  C: \ java> java PrintBits 
  Input int: 
30
  00000000 00000000 00000000 00011110 

  C: \ java> </ td> <td width="168" valign="top" class="ArticleTeitle"> 
  </ Td> </ tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle"> 

  ↑ Back 

keep looking »