Today i started reading Programming Jakarta Struts By Chuck Cavaness.
Nice book written by Chuck Cavaness.
I wanted to share few quotations found from the first 2 chapters from this book.
1) Java servlets have become the mainstay for extending and enhancing web applications using the Java platform. They provide a component-based, platform-independent method for building web applications. Servlets don't suffer from the same performance limitations that standard CGI applications incur. Servlets are more efficient than the standard CGI threading model because they create a single heavyweight process and allow each user request to use a much more lightweight thread, which is maintained by the Java Virtual Machine (JVM), to fulfill the request. Multiple user requests can be threaded through the same instance of a servlet. A servlet is mapped to one or more uniform resource locators (URLs), and when the server receives a request to one of the servlet URLs, the service method in the servlet is invoked and it responds. Because each user request is associated with a separate thread, multiple threads or users can invoke the service method at the same time. This multithreaded nature of servlets is one of the main reasons that they are more scalable than standard CGI applications. Also, because servlets are written in Java, they are not proprietary to a platform or OS.
2) With the Model 1 architecture, the JSP page handles all of the processing of the request and is responsible for displaying the output to the client.
In contrast, in the Model 2 architecture, the client request is first intercepted by a servlet, referred to as a controller servlet. This servlet handles the initial processing of the request and determines which JSP page to display next.
Main difference between the two approaches is that the Model 2 architecture introduces a controller servlet that provides a single point of entry and encourages more reuse and extensibility than the Model 1 approach. With the Model 2 architecture, there is a clear separation of the business logic, presentation output, and request processing. This separation often is referred to as a Model-View-Controller (MVC) pattern. While the Model 2 architecture might seem overly complicated, it actually can simplify an application greatly. Web applications built using the Model 2 approach generally are easier to maintain and can be more extensible than comparable applications built around the Model 1 architecture.
3) The controller portion of the web tier MVC design generally is a Java servlet. The controller in a web tier application performs the following duties:
a. Intercepts HTTP requests from a client
b. Translates each request into a specific business operation to perform
c. Either invokes the business operation itself or delegates it to a handler
d. Helps to select the next view to display to the client
e. Returns the view to the client.
4) There are many different types of containers—EJB containers, web containers, servlet containers, and so on. In general, containers provide a hosting environment for software components to run in. Containers provide general services that the components within the environment can use, so that the component developers don't have to worry about providing these services. A web container allows servlets, JSP components, and other Java classes to be deployed and executed within the container. Services such as the Java Naming and Directory Interface (JNDI), connection pooling, and transaction services can be configured at the container level—similar to the way in which EJB containers manage security, transactions, and bean pooling—and the component developers don't have to worry about managing these resources.
5) Remote Method Invocation (RMI) allows methods to be invoked on remote objects. Java's implementation of RMI, known as the Java Remote Method Protocol (JRMP), has been around for quite some time and is specifically designed for Java-to-Java remote communications.
One of the issues with JRMP is that a JVM must be running on both the client and the server. With the number of so-called legacy applications that are written in languages such as C++, Java needed a way to communicate with these systems. This is where RMI over IIOP helps out.
The Internet Inter-ORB Protocol (IIOP) was designed to allow distributed components to communicate with one another using TCP/IP. IIOP is language- and platform-independent.
By using RMI on top of IIOP, Java can communicate with applications written in many other languages and on various platforms. RMI/IIOP, as it often is written, is required to be supported by all EJB servers and exists in the EJB and J2EE specifications.
6) URL parameters are strings that are sent to the server with the client request. The parameters are inserted into the HttpServletRequest object from the URI query string and data that is sent in a POST method. The parameters are formatted as key/value pairs and are accessed by applications as request parameters. URL parameters play an important role in all web applications, and the Struts framework is no exception.
7) When the sendRedirect( ) method is invoked, it causes the web container to return to the browser a response indicating that a new URL should be requested. Because the browser issues a completely new request, any objects that are stored as request attributes before the redirect occurs will be lost. This is one of the biggest differences between a forward and redirect.
The forward() method of the RequestDispatcher class can be called only when no output has been committed to the client. Writing something to the response object and then calling forward() may result in an IllegalStateException being thrown by the container.
About the Author
Chuck Cavaness is a graduate from Georgia Tech with degrees in computer engineering and computer science, has built Java-based enterprise systems in the healthcare, banking, and B2B sectors. Working at an Internet company to design and develop software architecture, Chuck has spent many frustrating hours figuring out the dos and the don'ts of web applications. With each enterprise system he's developed, Chuck has learned several valuable lessons about building "real-world" web applications, information that he's made available to developers who haven't had the opportunity to work on large systems.
Chuck is the co-author of Special Edition Using Java 1.3 and Special Edition Using EJB 2.0, both available from QUE.
Wednesday, 29 October 2008
Subscribe to:
Post Comments (Atom)
1 comment:
There are many different types of business directories on the Internet. Although the goal is similar, which is to help promote your offline or online businesses, they serve different functions. Some business directories exist solely for internet marketers to build back links. Others may be location or niche specific. And yet others offer a wide range of promotion services to cater to the diverse needs of different customers.
World Business Directory
Post a Comment