Tomcat 5.5.11 get started

  Abstract: Tomcat 5.5.11 get started 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="735" border="0"> <tr> <td> </ td> </ tr> </ table> 

  Jakarta Tomcat project is an important component, is not recommended for sun and jsp servlet containers, jsp servlet and the latest standards can be found in the Tomcat, it is best for beginners get started jsp tools. 

  First, the installation 
  1, as an example to win2000: sun from the official Web site jdk1.5 (java2 platform Professional Edition 5.0) above, and installed in c: \ jdk1.5. 
  2, tomcat from the official website and download the latest version of jakarta-tomcat-5.5.11.exe following the prompts to install c: \ Tomcat 5.5. 
  3, copying c: \ jdk1.5 \ lib \ tools.jar to c: \ Tomcat 5.5 \ common \ lib under. 
  4, setting up the environment variables: 
  Java_Home = c: \ jdk1.5 
  Tomcat_Home = c: \ Tomcat 5.5 
  Second, click start: Start -> procedure -> Apache Tomcat 5.5-> Monitor Tomcat, and then double-click the icon on the task bar, windows are open, click start. 


  3, testing in the browser input http://127.0.0.1:8080/ test, as tomcat itself with the web server without the need to install web server. 

  4, html, jsp test our own web directory of the project should be focused on Tomcat 5.5 \ webapps below. 
  First established in a test webapps folder, in the test folder creation of a WEB-INF directory inside Add web.xml file, the directory structure is as follows: 
  [Test] 
[WEB-INF]
  Web.xml 

  Web.xml file reads as follows: 

  <? Xml version = "1.0" encoding = "ISO-8859-1"> 

  Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" 
  Xsi: schemaLocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
  Version = "2.4"> 

  Welcome Tomcat Test 

  Welcome to Tomcat 

  Then html, jsp files can be put under the test directory for testing such as the establishment of a test.jsp as follows: 
  <% @ Page language = "java"%> 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.util .*"%> 
  <% = New Date (). ToString ()%> 
  Http://localhost:8080/test/test.jsp can be called by the current date and time. 
  4. Servlet test configuration 
  1, to prepare and compile the following simple servlet, the compiler will be tomcat 5.5 \ common \ lib \ servlet in the category-api.jar Add document search path. 
  Import java.io. *; 
  Import javax.servlet .*; 
  Import javax.servlet.http .*; 

  Public class HelloWorld extends HttpServlet ( 
  Public void doGet (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException ( 
  Response.setContentType ( "text / html"); 
  PrintWriter out = response.getWriter (); 
  Out.println (""); 
  Out.println ( "Hello World"); 
  ) 
  ) 
  2, in the test / WEB-INF directory to build a classes directory, the directory structure is as follows: 
  [Test] 
[WEB-INF]
  [Classes] 
  Web.xml 
  Compiler will be available to the success of HelloWorld.class classes directory, web.xml file to read as follows: 

  <? Xml version = "1.0" encoding = "ISO-8859-1"> 
  Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" 
  Xsi: schemaLocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" 
  Version = "2.4"> 

  Welcome Tomcat Test 

  Welcome to Tomcat 


HelloWorld
HelloWorld


HelloWorld
  / HelloWorld 



  Restart Tomcat 5.0 
  By calling http://127.0.0.1:8080/test/HelloWorld hello world can see the output (download the source code) 

  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 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags: ,

Releated Java Articles

Comments

Leave a Reply