【文章內(nèi)容簡(jiǎn)介】
nerating pages that consist of large sections of fairly well structured HTML or other character data. Servlets are better for generating binary data, building pages with highly variable structure, and performing tasks (such as redirection) that involve little or no output. 4. Some tasks are better acplished by a bination of servlets and JSP than by either servlets or JSP alone. Versus , which is pletely distinct from the Java programming language, is normally used to dynamically generate HTML on the client, building parts of the Web page as the browser loads the document. This is a useful capability and does not normally overlap with the capabilities of JSP (which runs only on the server). JSP pages still include SCRIPT tags for JavaScript, just as normal HTML pages do. In fact, JSP can even be used to dynamically generate the JavaScript that will be sent to the client. So, JavaScript is not a peting technology。 it is a plementary one. It is also possible to use JavaScript on the server, most notably on Sun ONE (formerly iPla), IIS, and BroadVision servers. However, Java is more powerful, flexible, reliable, and portable. Versus WebMacro or is by no means perfect. Many people have pointed out features that could be improved. This is a good thing, and one of the advantages of JSP is that the specification is controlled by a munity that draws from many different panies. So, the technology can incorporate improvements in successive releases. However, some groups have developed alternative Javabased technologies to try to address these deficiencies. This, in our judgment, is a mistake. Using a thirdparty tool like Apache Struts that augments JSP and servlet technology is a good idea when that tool adds sufficient benefit to pensate for the additional plexity. But using a nonstandard tool that tries to replace JSP is a bad idea. When choosing a technology, you need to weigh many factors: standardization, portability, integration, industry support, and technical features. The arguments for JSP alternatives have focused almost exclusively on the technical features part. But portability, standardization, and integration are also very important. For example, the servlet and JSP specifications define a standard directory structure for Web applications and provide standard files (.war files) for deploying Web applications. All JSPpatible servers must support these standards. Filters can be set up to apply to any number of servlets or JSP pages, but not to nonstandard resources. The same goes for Web application security settings. Besides, the tremendous industry support for JSP and servlet technology results in improvements that mitigate many of the criticisms of JSP. For example, the JSP Standard Tag Library and the JSP expression language address two of the most wellfounded criticisms: the lack of good iteration constructs and the difficulty of accessing dynamic results without using either explicit Java code or verbose jsp:useBean elements. Misconceptions About JSP Fetting JSP Is ServerSide are some typical questions Marty has received (most of them repeatedly).Our server is running JDK . So, how do I put a Swing ponent in a JSP page?How do I put an image into a JSP page? I do not know the proper Java I/O mands to read image Tomcat does not support JavaScript, how do I