Create a message board with JSP program

Source: Internet
Author: User

JSP is short for assumerver Pages. It is a technology that integrates HTML and Java programs on a web page. I think using JSP to write programs is more challenging and knowledgeable than ASP, PHP, and other languages, because it involves the Object-Oriented JAVA language and should be used properly, you have to have a certain understanding of JAVA. In addition, you must be proficient in using various development tools, such as Dreamweaver, Photoshop, and JBuilder.

To do well, you must first sharpen your tools. Make some preparations before running the JSP program. First, you must have a WEB server that can be used by Apache or IIS. Second, you must have a compiler that executes JAVA programs. Second, you must have an engine that supports JSP. Currently, many engines are available, for example, tomcat, weblogic, and resin.

The message board program described in this article can run smoothly on the author's machine. The details are as follows:

Operating System: Windows 2000 SERVER
JAVA compiler: JDK1.3
WEB server: Apache1.13.2 + Tomcat3.1 Engine
Database: Access 2000

The configuration after Apache and Tomcat are installed is a bit challenging. The following is my installation process:

1) install JDK1.3
A) double-click the J2SDK1_3_0-WIN.exe file, install to C: \ jdk1.3 directory;
B) Update the following environment variables and add C: \ jdk1.3 \ lib \ tools. jar; C: \ jdk1.3 \ lib \ dt. jar; C: \ myclasses to CLASSPATH. Update method: Right-click my computer-properties-advanced-environment variables;
C) restart the computer.

2) install Apache1.13.2
A) double-click the apache_1_3_12_win32.exe file and install it in the C: \ Apache directory;
B) use NotePad to modify C: \ Apache \ conf \ httpd. conf:
◆. PORT: Set the Port number used when Apache Web Server is running. I will change it to PORT 8080, and enter http: // ip8080 in the browser to access the Apache Web Server;
◆. SERVERNAME: I set SERVERNAME to 202.38.126.134. This is the IP address of my machine );
◆. After Apache is installed, add an Apache Web Server menu group in the "Start-program" menu group and run the Install Apache as a service, in this case, an Apache service is added to "start-set-control panel-service". You can use it to start or stop the Apache service;
◆. Open "start-set-control panel-service", select Apache, and press "start" to start the Apache service.
C). In IE, enter http: // ip: 8080 ip address as the ip address of the machine you are using.) Does Apache run?

3) install Tomcat3.1
A).use winzipto decompress tomcat.zip to a directory, and finally make it C:/tomcat;
B) Open the C: \ Apache \ conf \ httpd. conf file and add a similar sentence at the end of the file: Include C:/tomcat/conf/tomcat. conf;
C ). modify the PORT number of Tomcat running. Note that Tomcat has an independent HTTP server. It must use an unused PORT number. I use PORT: 80 in C: \ tomcat \ conf \ server. modify in xml;
D) SET TOMCAT_HOME = c: \ tomcat
SET JAVA_HOME = c: \ jdk1.3 added to the C: \ tomcat \ bin \ tomcat. bat file. The modified file is as follows:
Rem Guess TOMCAT_HOME if it is not present
SET TOMCAT_HOME = c: \ tomcat
SET JAVA_HOME = c: \ jdk1.3 if not "% TOMCAT_HOME %" = "" goto gothome

E) double-click C: \ tomcat \ startup. bat to start Tomcat;
F) If you can see the Tomcat Version 3.1 page, it indicates that Tomcat is successfully installed.

At this point, the preparation work is almost done. Finally, create a directory under the Tomcat directory to store the compiled program. The details are as follows:
◆ C: \ tomcat \ fox -- store. html and. jsp files
◆ C: \ tomcat \ fox \ images -- Stores image files
◆ C: \ tomcat \ fox \ global -- store the database
◆ C: \ tomcat \ fox \ WEB-INF \ classes -- store JAVA class files

To make the JSP program in this directory run smoothly, you also need to add a few lines of code in the C: \ tomcat \ conf \ server. xml file:

 
 
  1. <Context path="/fox" docBase="fox" 
  2. defaultSessionTimeOut="30"isWARExpanded="true"  
  3. isWARValidated="false" isInvokerEnabled="true" 
  4. isWorkDirPersistent="false"/>  

The server. xml file after the code is added looks as follows:

 
 
  1. <Context path="" docBase="webapps/ROOT" debug="0" reloadable="true" >  
  2. </Context> 
  3. <Context path="/redfox" docBase="redfox" defaultSessionTimeOut="30" 
    isWARExpanded="true" isWARValidated="false" isInvokerEnabled="true" 
    isWorkDirPersistent="false"/>  
  4. <Context path="/test" docBase="webapps/test" debug="0" reloadable="true" >  
  5. </Context>  

Now, write a program named test. jsp stored in C: \ tomcat \ fox \ test. jsp.

 
 
  1. <html>  
  2. <body>  
  3.  <%java.util.Date date=new java.util.Date(); %>  
  4.  Hello! the time is now  
  5.  <%out.println(date);%>  
  6. </body>  
  7. </html>  

In IE, type http: // ip/fox/test. jsp. If you can see the current time, congratulations: You can start writing the message board program.

  1. Adding special characters causes exposure of JSP source code files
  2. Use JMeter to test JSP Application Performance
  3. Multi-thread synchronization in Servlet and JSP
  4. Analysis of the best solution example of JSP IIS
  5. Can JSP meet the Web boom?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.