I want to ask a question about the java web application. When I start to learn the JSP, I always hear about the Java EE web appli开发者_如何学运维cation. But I don't know the actually meaning of that word. Can anyone explain this word to me? Thank you.
A web application differs from other types of applications like desktop applications (Photoshop, for instance) in that most of the computation is done on a remote computer, and only the display data is sent to the user's machine. Normally, the user interface will be written in some kind of "web" technology - HTML/JavaScript/flash etc, and will be viewed using a web browser, hence the name.
In order for that to work, the remote machine (server) has to run an application which listens for client requests, does some computation and return the reply to the user. For instance, when you buy a book from amazon, the purchase button send a request to a remote application to process your order and return a confirmation message.
There are many details involved in this process - the application has to listen to requests, it has to handle failures, maybe connect to a database and many more things. Because much of this work is similar in any web application, it is common practice to use something called an application server to do that work for you.
An application server is an application that knows how to run other applications and do some of their work for them. So now, when the user sends a request to the web application, the applications server gets it, maybe extracts some data from it and validates it, and then tells your application to handle the business logic. This way you don't have to worry about things like communication whenever you write a web application.
There are web servers for all kinds of technologies. For instance - IIS is a web server for .Net web applications.
Java EE is actually a collection of specifications (which is a fancy word for a bunch of interface and orders how to implement them) which define how you should write your java application and how a vendor should implement his application server so that they can work together. The "container" someone mentioned here before is a Java EE name for the vendor's application server.
You said you are learning how to write JSPs. When you write a JSP, you actually implement a spec that defines how to write a Java EE display component, which can be translated to HTML. Your application server (Tomcat/JBoss/BEA whatever) knows what to do with your JSP in order to produce the wanted HTML and then send it to the user.
There is a hierarchy of Java distributions.
Starting with Java ME -- micro edition for embeded applications on small machines like phones.
Moveing on to JavaSE which is the standard edition most programmers are familier with.
Then moving up to J2EE -- enterprise Edition. In addition to SE a J2EE distribution must support several Enterprise level libraries and APIs in the javax.... series of interfaces. The most important of these are the "transactional container", EJB and WS* web services APIs.
These interfaces are implmented by third parties some open source such as GlassFish and JBOSS but mostly by proprietary (end expensive) products like WebLogic or WebSphere.
A Web Application refers to a specific kind of "module" that can be deployed onto an EE container like Tomcat, WebLogic, or GlassFish. It is a collection of JSPs, JSFs, and other classes.
Unlike a regular Java application, an EE web application can't just be "run" by typing "java". It must be deployed to your web server. Once the server is running, you can take advantage of a lot of built-in features, which, while useful, can be a lot like drinking from an acronym firehose.
Unfortunately, there's no easy way to get into it. From what I hear, the best way to start is with the Sun tutorials. There are also a number of books out there. The most important concept to get is the idea of the "container" in which your EE application will run. It's like have a virtual machine within a virtual machine. It's a weird concept.
Happy hunting! Jeff
精彩评论