1. Introduction to Java Web Server Selection
In actual implementation of java Web projects, we can use commercial java Web servers such as Ibm WebSphere and Bea Web Logic. These two servers have complete functions and are powerful. They support all java service container standards and are suitable for the release of commercial java Web applications. However, these two types of servers are commercial servers, which are expensive and require extremely high system resources. In particular, the Websphere configuration is complex. It is not suitable for development if you do not use ibm Websphere Studio Application. In addition, different versions have different requirements for servlet. jar and other javax components and jdk. For example, servlet. jar required by Websphere 3.5 supports the old version of javax. servlet. http. HttpSession, and does not support session. setAttribute () session. getAttribute ().
In the development or learning process, there are many free and lightweight Java Web servers for us to choose from, such as Tomcat, Resin, Orion and so on.
They are easy to use and consume few resources. They are suitable for continuous debugging during development. They can also be integrated with integrated development tools such as Jbuilder.
. Based on actual development, Jakata Tomcat and Sun Java are the best combination, and can be used with other application servers.
The complete j2ee standard is widely used. However, from the general coding problems in Java, Resin is the best solution. Also enable
In terms of usage, I personally think that Resin is more convenient than Tomcat, and Resin can also be used in combination with ide such as Jbuilder6. Resin emphasizes Xml
You can see from Resin's own HomePage using xtp.
Ii. installation and configuration of Resin
Resin is available for free download and use in http://www.caucho.com/download/index.xtp. Development or learning with Resin is free
But if you use Resin as a paid product, you need to pay for it. The current version is 2.10.
When downloading Resin, select resin-2.1.0.zip from windows.zipin Archive Versions.
Decompress the zip package to any directory, such as d: esin. The following describes how to install Resin in d: esin. Enter d: esinin,
Type httpd to run the Resin server on the command line console. The following pop-up shows two Radio buttons, start and stop, and close.
Button dialog box. The running information of Resin is displayed here. At the same time, Resin can be stored in the Directory d: esinlog
In the stdout. log file. For example:
Resin 2.0.4 (built Thu Nov 15 17:56:24 PST 2001)
Copyright (c) 1998-2001 Caucho Technology. All rights reserved.
Starting Resin on Wed, 23 Jan 2002 14:41:47 + 0800 (CST)
Http listening to *: 80
Srun listening to haitaiserver: 6802
Click stop to stop the current Resin server process. Click start to start a new Resin server process. Close this dialog
Return to the drive letter prompt on the Command console. If you use Resin as a service in nt4 or win2k, you only need
In this directory on the Command console, type httpd? Install, you can see a new Resin under the management tool Service
Web Server's automatic service. You can start the Resin service as long as you enter nt 4 or win2k. This service can also be like other services 1
The sample is set to manual or disabled. Note that sometimes, after installing the service, start Resin and you cannot see your own Resin routine.
Resolved, the browser shows that the server cannot find the error. You only need to restart win2k or nt to solve the problem.
The following describes the configuration of the Resin server. The Resin server is configured using an Xml file like most Java Web servers.
Go to the d: esinconf directory and open resin. conf, which is a text in xml format.
There are many tags here. First, find them: & lt http-server & gt. In the & lt http-server & gt & lt/http-server & gt tag, configure
Java Web server. Find the root that represents resin in the & lt app-dir & gt & lt/app-dir & gt tag, which is equivalent
Htdocs or IIS wwwroot. Resin comes with an http server, but you can also use it without using Apache or IIS as an http server.
Server. This is mentioned in the following section.
Find the & lt http port = 8080/& gt mark, which can be configured like this & lt http host = localhost port = 80/& gt. Host Parameter
It is a server. port specifies the http port. The default values are localhost and 8080. & Lt srun host = localhost port = 6802/& gt
Mark. This is the engine configuration of jsp and java Servlet. This is usually done by default, unless port 6802 is occupied by other programs. However
Then configure jdk. This needs to be set in classpath. Right-click my computer, click environment variables in the Advanced tab of system features,
Create an environment variable named classpath in the system variable and set the value to the directory where jdk is located. Create another environment variable, the variable
The value is pathand the value is the directory where javac.exeand java.exe are located (in the bin directory under the jdk directory ). Generally
Then, Resin can be used. In d: esindoc (assume that the name of your & lt appdir & gt & lt/appdir & gt pair is doc, that is, the root is
D:/resin/doc, and your & lt http host = localhost port = 80/& gt as configured on the left), you can write a jsp file, if you can write
Test. jsp files. The content is & lt % = 1 + 2 + 3% & gt. Then, in the browser, type http: // localhost/test. jsp. If you can see
6 In the browser indicates that the Resin server is running properly. Note: After you modify the configuration, You can generally restart resin to see
Change.
Iii. Introduction to Resin
When using Resin to develop Java Web projects, you must create your own WebApp. The development and use of Resin Cmp/Ejb are not described here.
Resin is used to develop common jspjava servlet projects. Here we will also talk about the resin. conf configuration. There are two ways to apply Resin.
Release: First, release in the Resin directory; second, package it into War for release.
1. Publish in the Resin directory
Search for the & lt web-app & gt tag in resin. conf, which indicates a web application.
The id attribute indicates the Web path of the application. For example, & lt web-app id =/test & gt indicates that the application should use
Http: // hostname/test. The app-dir attribute indicates the actual path of the application. For example
& Lt app-dir & gtd: esindocest & lt/app-dir & gt indicates that the application is under the d: esindocest directory. The default value is the root and id.
Directory with the same name. Resin can be configured with three types of error-page: 404 error, that is, the error page cannot be found in the file; Exception violation page; cannot be connected
Java engine page. They can be set in this way respectively.
404 page not found for file
& Lt web-app id =/app1 & gt
& Lt