(Author: Small Longting main Blueski compiled December 22, 2000 14:22)
(Continuation of the article)
Problem #3: Simple work is still tiring
Even simple work, such as header and footer, is still difficult in JSP. Suppose you have a "header" and a "footer" template to include in all pages, and each template contains the current page title in the content.
The best way to do this in a JSP is to:
<% String title = "The Page title"; %>
<%@ include file= "/header.jsp"%>
... The content of your page ...
<%@ include file= "/footer.jsp"%>
The page designer should remember not to omit the semicolon from the first line and to define title as a string. In addition,/header.jsp and/footer.jsp must be in the root directory and must be accessible to the full file.
It is simpler to include headers and footers in Webmacro:
#set $title = "The Page title"
#parse "HEADER.WM"
Your content Here
#parse "FOOTER.WM"
There is no semicolon or definition of title to be remembered for the designer, and the. wm file can be placed under a customizable search path.
Problem #4: Very rough cycle
Looping through a JSP is difficult. Here is a JSP to duplicate the name of each ISP object.
Maybe there will be user-defined tags to do these loops. The same is true for "if". The JSP page may look like a very odd Java code. At the same time, the Webmacro cycle is beautiful:
#foreach $isp in $isps {
The next name is $isp. Name
}
#foreach指令可被自定义的 #foreach-backwards instructions are easily replaced if necessary.
Using JSP words is likely to change: (Here is a possible Mark
The next name is -->
The designer will of course choose the former.
Problem #5: Useless error messages
JSP often has some surprising error messages. This is because the page is first converted into a servlet before it is compiled. Good JSP tools can relatively increase the likelihood of finding the wrong location, but even the best tools won't make all the error messages easy to read. Due to the process of transformation, some errors may not be recognized by the tool at all.
For example, suppose a JSP page needs to create a title that is common to all pages. There is nothing wrong with the following code:
<% static String title = "Global title"; %>
However, Tomcat provides the following error message:
This information holds that the above script is put into the _jspservice () method and the static variable is not allowed into the method. The syntax should be <%! %>. It is difficult for page designers to read these error messages. Even the best platforms are not doing enough in this area. Even if all Java code is moved out of the page, it does not solve the problem. In addition, what is wrong with the following expression?
<% Count%>
Tomcat gives:
Work/8080/_0002ftest_0002ejsptest_jsp_0.java:56:class count not found in
In other words, it's just a missing tag. Should be <%= count%>.
Because template engine can be generated directly in template files without any dramatic conversion to the code, the appropriate error reporting can be easily given. And so on, when the C language command is taken into the Unix shell command line, you don't want the shell to generate a C program to run the command, but simply require the shell to simply interpret the command and execute it, if there is an error.
Problem #6: Need a compiler
The JSP requires a compiler to be placed in the webserver. This becomes problematic because Sun refuses to give up the Tools.jar library that contains their javac compilers. The Web server can be included in a third party compiler such as IBM's Jikes. But such a compiler does not work smoothly on all platforms (written in C + +) and is not conducive to the establishment of a pure Java Web server. JSP also has a precompiled option that can play a role, but not perfect.
Problem #7: Waste of space
The JSP consumes extra memory and hard disk space. For every 30K JSP file on the server, there must be a corresponding class file larger than 30K to produce. Actually doubles the hard disk space. Considering that JSP files can be easily passed at any time
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.