Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

More Java Pitfalls Share Reactor - Daconta M,C.

Daconta M,C. More Java Pitfalls Share Reactor - Wiley publishing, 2003. - 476 p.
ISBN: 0-471-23751-5
Download (direct link): morejavapitfallssharereactor2003.pdf
Previous << 1 .. 112 113 114 115 116 117 < 118 > 119 120 121 122 123 124 .. 166 >> Next

01 <?xml version="1.0"?>
02 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web 2
Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
03 <web-app>
04
05 <servlet>
06 <servlet-name>RedirectServlet</servlet-name>
07 <display-name>RedirectServlet</display-name>
08 <description>RedirectServlet</description>
09 <servlet-class>
10 org.javapitfalls.item3 6.RedirectServlet
11 </servlet-class>
12 </servlet>
13 <servlet>
14 <servlet-name>SimpleOrder</servlet-name>
15 <display-name>SimpleOrder</display-name>
16 <description>SimpleOrder</description>
17 <servlet-class>
18 org.javapitfalls.item3 6.SimpleOrder
19 </servlet-class>
20 </servlet>
21 <servlet>
22 <servlet-name>ControllerServlet</servlet-name>
23 <display-name>ControllerServlet</display-name>
Listing 36.5 web.xml
Too Many Submits 325
24 <description>ControllerServlet</description>
25 <servlet-class>
26 org.javapitfalls.item3 6.ControllerServlet
27 </servlet-class>
28 <init-param>
29 <param-name>id</param-name>
30 <param-value>id</param-value>
31 </init-param>
32 </servlet>
33
34 <servlet>
35 <servlet-name>TestServlet</servlet-name>
36 <display-name>TestServlet</display-name>
37 <description>TestServlet</description>
38 <servlet-class>
39 org.javapitfalls.item3 6.TestServlet
40 </servlet-class>
41 </servlet>
42 <servlet>
43 <servlet-name>form</servlet-name>
44 <jsp-file>/ticketForm.jsp</jsp-file>
45 </servlet>
46
47 <servlet>
48 <servlet-name>success</servlet-name>
49 <jsp-file>/success.jsp</jsp-file>
50 </servlet>
51
52 <servlet>
53 <servlet-name>resubmit</servlet-name>
54 <jsp-file>/resubmitError.jsp</jsp-file>
55 </servlet>
56
57 <servlet-mapping>
58 <servlet-name>RedirectServlet</servlet-name>
59 <url-pattern>/RedirectServlet</url-pattern>
60 </servlet-mapping>
61
62 <servlet-mapping>
63 <servlet-name>SimpleOrder</servlet-name>
64 <url-pattern>/SimpleOrder</url-pattern>
65 </servlet-mapping>
66
67 <servlet-mapping>
68 <servlet-name>ControllerServlet</servlet-name>
69 <url-pattern>/ControllerServlet</url-pattern>
70 </servlet-mapping>
71
72 <servlet-mapping>
Listing 36.5 (continued)
326 Item 36
73 <servlet-name>TestServlet</servlet-name>
74 <url-pattern>/TestServlet</url-pattern>
75 </servlet-mapping>
76
77 </web-app>
78
Listing 36.5 (continued)
In this pitfall we discussed a number of solutions to the multiple-submit problem. Each solution, as with almost every solution, had its positive and negative aspects. When solving problems, we must clearly understand the various pros and cons of a solution so we can assess the value of each trade-off. Our final JavaScript example had the benefit of solving the problem at hand, but had the trade-off that we needed to make an extra round-trip to the client in order to make it work. The first JavaScript solution was perhaps the most elegant, but required that the client enables JavaScript for it to work. The final application would serve those well that opted to forego the use of JavaScript to avoid browser incompatibilities with the scripting language. As with any problem, there is often a world of solutions, each one with its own trade-offs. By understanding the trade-offs of a given solution, we can make the most informed choice for a given problem.
PART
Three
The Enterprise Tier
"Machine capacities give us room galore for making a mess of it. Opportunities unlimited for fouling things up! Developing the austere intellectual discipline of keeping things sufficiently simple is in this environment a formidable challenge,
both technically and educationally."
Edsger W. Dijkstra,
from "The Threats to Computing Science," EWD Manuscript #898
In that paper, which he wrote in 1984, Dijkstra suggests that in a world of incredibly fast computers and increasingly complex programming environments, simplicity is the key. "We know perfectly well what we have to do," he writes, "but the burning question is, whether the world we are a part of will allow us to do it."11 would contend that the frameworks present in Java, and specifically on the server side today, provide the beginnings of such a world—not that this will completely keep us from fouling things up! As this book shows you, there are always opportunities for that. However, when we do not have to worry about the management of services such as memory, threads, connection pooling, transactions, security, and persistence, things get simpler. When we allow the container to handle the details of these services for us, we can focus where Dijkstra thought we should focus: on the logic of our application itself.
The J2EE environment provides the atmosphere for Java programmers to focus on application logic. Because application servers focus on the "hard stuff," we can focus on the business logic of our applications. However, since programming in this environment represents a change in mind-set, new enterprise developers stumble into
1 Dijkstra, Edsger. "The Threats to Computing Science." EWD manuscript #898. Available at http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD898.PDF.
Previous << 1 .. 112 113 114 115 116 117 < 118 > 119 120 121 122 123 124 .. 166 >> Next